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

 Accepted Answer

>> 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 MATLAB in Help Center and File Exchange

Asked:

on 12 Dec 2018

Commented:

on 26 Dec 2018

Community Treasure Hunt

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

Start Hunting!