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
Best Answer