How do I convert a decimal number to a time?
36 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Liam Quantrill
am 2 Aug. 2018
Kommentiert: Walter Roberson
am 14 Sep. 2019
How would I convert a number such as 7.8 into a time in HH:MM? 7.8 is 7.8 hours from the start of the day, so should be shown as 07:48.
2 Kommentare
Akzeptierte Antwort
Weitere Antworten (1)
KALYAN ACHARJYA
am 2 Aug. 2018
Bearbeitet: KALYAN ACHARJYA
am 2 Aug. 2018
datestr(hours(7.8),'HH:MM');
Result
>> datestr(hours(7.8),'HH:MM')
ans =
07:48
4 Kommentare
Sean de Wolski
am 2 Aug. 2018
Bearbeitet: Sean de Wolski
am 2 Aug. 2018
This is the old way to to it (before R2014b). In more recent releases, the duration approach is better.
Siehe auch
Kategorien
Mehr zu Resizing and Reshaping Matrices finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!