build YYYYMMDD instead of YYYYMD, for YY and DD derived from one-digit outputs from datevec()
1 次查看(过去 30 天)
显示 更早的评论
Hello. I would like to produce a date (for instance: 7th of January 2014) string looking like '20140107' for representing YYYYMMDD, but a one digit M and D currently results in the unwanted string '201417', which is only YYYYMD.
[Y, M, D, H, MN, S] = datevec(now);
dateString =[num2str(Y),num2str(M),num2str(D)];
1 个评论
采纳的回答
Phillip
2014-4-30
Hi
dateString = datestr(now,'yyyymmdd')
Type
help datestr
to get more information
Regards, Phillip
0 个评论
更多回答(1 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Whos 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!