I am trying to convert "145601" into "14:56:01". How can I do this in a for loop?

 Réponse acceptée

Star Strider
Star Strider le 30 Août 2023
No loop needed. Just use datetime
str = "145601"
str = "145601"
DT = datetime(str, 'InputFormat',"HHmmss", 'Format','HH:mm:ss')
DT = datetime
14:56:01
.

2 commentaires

Happy PhD
Happy PhD le 30 Août 2023
Thanks.
Star Strider
Star Strider le 30 Août 2023
As always, my pleasure!

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

Produits

Version

R2022b

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by