Convert string into date

2 次查看(过去 30 天)
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
No loop needed. Just use datetime
str = "145601"
str = "145601"
DT = datetime(str, 'InputFormat',"HHmmss", 'Format','HH:mm:ss')
DT = datetime
14:56:01
.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Characters and Strings 的更多信息

标签

产品


版本

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by