MATLAB: Is there an error in the documentation example for the ADDTODATE function in MATLAB

addadddatedateMATLABtime

The example in the documentation for the ADDTODATE function states that the following command:
R = addtodate(datenum('12/24/1984 12:45'), 20, 'day');
datestr(R)
should return the following result:
ans =
13-Jan-1999 12:45
However, when I execute the above example, I obtain a different result:
ans =
13-Jan-1985 12:45:00

Best Answer

This change has been incorporated into the documentation in Release 14 Service Pack 3 (R14SP3). For previous releases, read below for any additional information:
This has been verified as an error in the documentation for the ADDTODATE function within MATLAB. The documentation should read as follows:
"Adding 20 days to the given date in late December causes the calendar to roll over to January of the next year: "
R = addtodate(datenum('12/24/1984 12:45'), 20, 'day');
datestr(R)
ans =
13-Jan-1985 12:45:00