ADDDATE(date,INTERVAL expression type)

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 +.

Table C.1. Values for expression and type When Adding and Subtracting Time Using ADDDATE(), SUBDATE(), and Synonymous Functions
Value of typeFormat for expression
SECONDss
MINUTEmm
HOURhh
DAYDD
MONTHMM
YEARYY
MINUTE_SECOND"mm:ss"
HOUR_MINUTE"hh:mm:ss"
DAY_HOUR"DD hh"
YEAR_MONTH"YY-MM"
HOUR_SECOND ...

Get Sams Teach Yourself MySQL in 21 Days, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.