problem with datetime : day is wrong
1 view (last 30 days)
Show older comments
year=2008
month=2
day=31
hh =[ year month day ]
datetime(hh) %it's not correct ((correct day is 31 not 2)
%i try to change datetime default but the result is the same
datetime.setDefaultFormats('defaultdate','yyyy-MM-dd')
datetime(hh)
0 Comments
Accepted Answer
Angelo Yeo
on 22 Sep 2023
There was no Feb 31st in 2008.
4 Comments
Walter Roberson
on 22 Sep 2023
It is a common trick to code datetime([year 1 daynumber]) instead of datetime([year 1 1])+days(daynumber-1)
More Answers (0)
See Also
Categories
Find more on Dates and Time 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!