How to convert decimal to time?
50 次查看(过去 30 天)
显示 更早的评论
eg: 7.6 (7+0.6*60) = 7:36
0 个评论
采纳的回答
per isakson
2017-10-10
编辑:per isakson
2017-10-10
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.
更多回答(1 个)
Peter Perkins
2017-10-13
编辑:Peter Perkins
2017-10-13
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 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Dates and Time 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!