How to convert decimal to time?
조회 수: 52 (최근 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!