bug of addtodate when combining with now?
Info
This question is closed. Reopen it to edit or answer.
Show older comments
addtodate function returns very odd results when combined with now.
>>datestr(now,'yyyymmdd')
ans =
20140814
>>datestr(addtodate(now,-1,'day'),'yyyymmdd')
ans =
19700101
>>datestr(addtodate(now,1,'day'),'yyyymmdd')
ans =
19700101
Is that a known bug? Or have I missed something obvious?
3 Comments
Christopher Berry
on 14 Aug 2014
Yucheng,
I am not able to reproduce this:
>> datestr(addtodate(now,1,'day'),'yyyy-mm-dd')
ans =
2014-08-15
>> datestr(addtodate(now,-1,'day'),'yyyy-mm-dd')
ans =
2014-08-13
What version of MATLAB are you using? How about your OS? You can check this by typing:
>> ver
dpb
on 14 Aug 2014
Also
which now
which addtodate
just to be sure haven't aliased something somehow.
If after all the sanity checks and 'clear all' still does it, it's bug report time, fur shure...
Also, indeed can't reproduce it here, either R2012b which is getting somewhat date, granted...
Yucheng
on 21 Aug 2014
Answers (0)
This question is closed.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!