converting number to date number
12 次查看(过去 30 天)
显示 更早的评论
I have a column of dates that are number (double format) such as 19940127 how can i convert it to matlab numeric date that corresponds to 1994/01/27?
0 个评论
采纳的回答
Star Strider
2016-10-1
编辑:Star Strider
2016-10-1
One approach:
dd = 19940127;
out = datestr(datenum(num2str(dd, '%d'), 'yyyymmdd'), 'yyyy/mm/dd')
out =
1994/01/27
To get the date number, just use part of that:
out_dn = datenum(num2str(dd, '%d'), 'yyyymmdd')
EDIT — Added ‘out_dn’.
0 个评论
更多回答(1 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Dates and Time 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!