Splitting time into hours : minutes : seconds from a fractional value.

조회 수: 11 (최근 30일)
WASIM ASHRAF
WASIM ASHRAF 2021년 4월 19일
댓글: WASIM ASHRAF 2021년 4월 21일
Hello Everyone,
Can anyone help me for converting a fractional value in the time format?
e.g. 15.76 = HH:MM:SS format.

채택된 답변

Stephan
Stephan 2021년 4월 19일
I guess 15.76 means hours in decimal numbers:
[h,m,s] = hms(hours(15.76))
d = duration(h,m,s)
gives:
h =
15
m =
45
s =
36
d =
duration
15:45:36
  댓글 수: 2
Walter Roberson
Walter Roberson 2021년 4월 19일
t = hours(15.76);
t.Format = 'hh:mm:ss'
t = duration
15:45:36
WASIM ASHRAF
WASIM ASHRAF 2021년 4월 21일
Thanks Stephan, due to this small code my full problem was stuck. Now my code is working fine.
Thanks a lot.

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

추가 답변 (0개)

카테고리

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