Name

ADDDATE( )

Synopsis

ADDDATE(date,INTERVAL value type)

This function adds the given interval of time to the date or time provided. This is an alias for DATE_ADD(); see its definition for details and interval types.

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

This example postpones the seminar that was scheduled for December 15, 2004 to December 22—seven days later. As of Version 4.1 of MySQL, for adding days the second argument of the function may simply be the number of days (i.e., just 7 instead of INTERVAL 7 DAY).

Get MySQL in a Nutshell 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.