|MATLAB Function Reference|
Modify date number by field
R = addtodate(D, Q, F)
Q to the indicated date field
F of a serial date number
D, returning the updated date number
Q to be added must be a double scalar whole number, and can be either positive or negative. The date field
F must be a 1-by-
N character array equal to one of the following:
If the addition to the date field causes the field to roll over, MATLAB adjusts the next more significant fields accordingly. Adding a negative quantity to the indicated date field rolls back the calender on the indicated field. If the addition causes the field to roll back, MATLAB adjusts the next less significant fields accordingly.
20 days to the given date in late December causes the calendar to roll over to January of the next year:
© 1994-2005 The MathWorks, Inc.