how to convert 5.5 hour to 05:30:00 HH:MM:SS format?

2 views (last 30 days)
how to convert 5.5 hour to 05:30:00 HH:MM:SS format?

Accepted Answer

Stephen23
Stephen23 on 12 Dec 2018
>> datestr(5.5/24,'HH:MM:SS')
ans = 05:30:00

More Answers (1)

Stephan
Stephan on 12 Dec 2018
Edited: Stephan on 12 Dec 2018
a = hours(5.5);
b = datetime('00:00:00','Format','HH:mm:ss');
result = a+b
result =
datetime
05:30:00

Categories

Find more on Dates and Time in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!