Convert string into date

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

 Risposta accettata

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 Commenti

Happy PhD
Happy PhD il 30 Ago 2023
Thanks.
Star Strider
Star Strider il 30 Ago 2023
As always, my pleasure!

Accedi per commentare.

Più risposte (0)

Categorie

Prodotti

Release

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by