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

 採用された回答

Star Strider
Star Strider 2023 年 8 月 30 日

0 投票

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 件のコメント

Happy PhD
Happy PhD 2023 年 8 月 30 日
Thanks.
Star Strider
Star Strider 2023 年 8 月 30 日
As always, my pleasure!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeDates and Time についてさらに検索

製品

リリース

R2022b

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by