Why does the DATEVEC function return inaccurate results in MATLAB 7.0 (R14)?
Show older comments
The following steps reproduce this behavior:
1) Close any open instance of MATLAB.
2) Change the time zone on your machine to one of the +02:00 zones (i.e., +02:00 Cairo).
3) Restart MATLAB.
4) Execute the following commands:
datevec(['16-Apr-07';'27-Apr-07'])
This returns:
ans =
2007 4 16 0 0 0
2007 4 26 23 0 0
when it should return:
ans =
2007 4 16 0 0 0
2007 4 27 0 0 0
However, if the order of the two dates are reversed, the date vectors returned are correct:
datevec(['27-Apr-07';'16-Apr-07'])
ans =
2007 4 27 0 0 0
2007 4 16 0 0 0
Accepted Answer
More Answers (0)
Categories
Find more on Dates and Time in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!