Convert time from 24 hours format to HH:MM

I am trying to convert time in the 24 hour format to HH:MM. I require this to write with the title in a figure. For example, time now reads as 12.5 and i need to write this as 12:30. can somebody help me?

 Réponse acceptée

Walter Roberson
Walter Roberson le 9 Août 2012
sprintf('%02d:%02d', floor(T), floor(60 * mod(T,1)) )

2 commentaires

Sreeja
Sreeja le 9 Août 2012
Thanks a lot..it worked!!!!
Walter Roberson
Walter Roberson le 9 Août 2012
It has problems with leap seconds.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

Community Treasure Hunt

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

Start Hunting!

Translated by