ADDDATE( )

This MySQL function can be used to add a given interval of time to a date or the value of a date column

Syntax

Below is the syntax for this command. Text within square brackets (i.e, [ and ] ) are optional. Choices are separated by bars (i.e, | ). Ellipses preceded by a comma indicates a repeating pattern. Ellipses before or after syntax are used to highlight a relevant except from the larger syntax. Text displayed in italic letters represent text that should be replaced with the specific names related to the database (e.g., column with the name of the column).

ADDDATE(date, INTERVAL value type)
ADDDATE(date, days)

Explanation

This function adds the given interval of time to the date or time provided. This is a synonym for DATE_ADD(); see its definition for details and interval types. The second, simpler syntax is available as of version 4.1 of MySQL. This short-hand syntax does not work, though, with DATE_ADD().

Examples

UPDATE seminars
SET seminar_date = ADDDATE(seminar_date, INTERVAL 1 MONTH)
WHERE seminar_date = '2007-12-01';

UPDATE seminars
SET seminar_date = ADDDATE(seminar_date, 7)
WHERE seminar_date = '2007-12-15';

The first SQL statement postpones a seminar that was scheduled for December 1, 2007 to a month later, to January 1, 2008. The second statement postpones the seminar on December 15 to December 22, seven days later.