Description: Returns the date that results from adding an interval expression to date (a DATE or DATETIME type), where the interval is of type as shown in Table C.1.
If date is of type DATE and type contains only year, month, and day calculations, a date will result; if date is of type DATETIME or type includes hour, minute, or second calculations, a date and time will result.
ADDDATE() is synonymous with DATE_ADD() and +.
Value of type | Format for expression |
---|---|
SECOND | ss |
MINUTE | mm |
HOUR | hh |
DAY | DD |
MONTH | MM |
YEAR | YY |
MINUTE_SECOND | "mm:ss" |
HOUR_MINUTE | "hh:mm:ss" |
DAY_HOUR | "DD hh" |
YEAR_MONTH | "YY-MM" |
HOUR_SECOND | "hh:mm:ss" |
DAY_MINUTE | "DD hh:mm" |
DAY_SECOND | "DD hh:mm:ss" |
Examples:
ADDDATE('2002-01-05',INTERVAL 3 DAY) returns 2002-01-08.
ADDDATE('2002-01-05 12:00:00',INTERVAL 3 DAY) returns 2002-01-08 12:00:00.
ADDDATE('00-02-07 09:00:00',INTERVAL 36 HOUR) returns 2000-02-08 21:00:00.
ADDDATE('1964-12-01',INTERVAL "37 6" YEAR_MONTH) returns 2002-06-01.
See also: DATE_ADD(), SUBDATE()
3.16.48.181