필터 지우기
필터 지우기

How to convert decimal to time?

조회 수: 52 (최근 30일)
oshawcole
oshawcole 2017년 10월 10일
편집: Peter Perkins 2017년 10월 13일
eg: 7.6 (7+0.6*60) = 7:36

채택된 답변

per isakson
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
oshawcole
oshawcole 2017년 10월 10일
How do I do it if I want 7:36 PM?

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Peter Perkins
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

카테고리

Help CenterFile Exchange에서 Dates and Time에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by