how to convert yymmdd to dd/mm/yyyy
7 次查看(过去 30 天)
显示 更早的评论
Hi
Does anyone know how to convert yymmdd to dd/mm/yyyy? I have dates is given in the yymmdd format, such as 750525,780215,.....which mean year 1975, month-5, day-25 or year 1978, month-2,day-15. I wanted to convert the date in the form dd/mm/yyyy which is as 25/05/1975, 15/02/1978.
How I can do it?
Thanks a lot!
0 个评论
采纳的回答
Jos (10584)
2016-6-6
A = {'750525','780215'}
B = cellstr(datestr(datenum(A,'yymmdd'),'dd/mm/yyyy'))
5 个评论
Jos (10584)
2016-6-6
A0 = [750525, 780215] A = arrayfun(@(x) sprintf('%06d',x), A0, 'un', 0) % convert to cell array of strings
更多回答(1 个)
Steven Lord
2016-6-6
Use the 'ConvertFrom' option with datetime to create a datetime object representing your date.
x = 19990511;
D = datetime(x, 'ConvertFrom', 'yyyymmdd')
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Calendar 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!