Info

This question is closed. Reopen it to edit or answer.

bug of addtodate when combining with now?

1 view (last 30 days)
Yucheng
Yucheng on 14 Aug 2014
Closed: MATLAB Answer Bot on 20 Aug 2021
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
dpb
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
Yucheng on 21 Aug 2014
Thanks for looking into the problem. It is a bit frustrating that I cannot reproduce the same problem today when I tried again (even though I have not even restarted my matlab):(

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!