How to convert decimal to time?
47 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
oshawcole
il 10 Ott 2017
Modificato: Peter Perkins
il 13 Ott 2017
eg: 7.6 (7+0.6*60) = 7:36
0 Commenti
Risposta accettata
per isakson
il 10 Ott 2017
Modificato: per isakson
il 10 Ott 2017
datestr takes days as input. Thus, divide by 24.
>> val = 7.6;
>> datestr( val/24, 'HH:MM' )
ans =
07:36
I guessed that seven is hours, not minutes.
Più risposte (1)
Peter Perkins
il 13 Ott 2017
Modificato: Peter Perkins
il 13 Ott 2017
This depends on what you mean by "time". Likely, the most useful thing is a duration:
>> t = hours(7.6)
t =
duration
7.6 hr
>> t.Format = 'hh:mm:ss'
t =
duration
07:36:00
0 Commenti
Vedere anche
Categorie
Scopri di più su Dates and Time in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!