datestr generating different string
2 views (last 30 days)
Show older comments
I have an array with days, months and years. This is my string
[myd '/' mym '/' myy]
ans =
20/01/2014
But datestr generates this
datestr([myd '/' mym '/' myy])
ans =
06-Jul-0025
Any clue?
Thanks
0 Comments
Accepted Answer
Chad Greene
on 1 May 2021
How about
myy = 2014;
mym = 1;
myd = 20;
datestr(datenum(myy,mym,myd),'dd/mm/yyyy')
3 Comments
Chad Greene
on 1 May 2021
How's this?
datestr(datenum(string([myd '/' mym '/' myy]),'dd/mm/yyyy'))
More Answers (0)
See Also
Categories
Find more on Operators and Elementary Operations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!