datetime to string conversion
6 次查看(过去 30 天)
显示 更早的评论
I have
day = datetime(2008,04,01)
with the output
day =
datetime
01-Apr-2008
I then run
string(day)
with the output
ans =
"01-Apr-2008"
But I want to have a string "20080401." Is there any simple way to do this?
0 个评论
采纳的回答
Star Strider
2022-3-12
Ise the 'Format' name-value pair —
dayv = datetime(2008,04,01, 'Format','yyyyMMdd')
string(dayv)
.
2 个评论
Star Strider
2022-3-12
Again, use 'Format' —
datelimits = datetime({'20080401', '20080402'}, 'InputFormat', 'yyyyMMdd', 'Format','yyyyMMdd')
.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Data Type Conversion 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!