ADDDATE

Add a time interval to a date. This function performs date arithmetic, adding a specified value like days or hours to a starting date.

Syntax

ADDDATE(date,INTERVAL expr unit), ADDDATE(expr,days)

Description

When invoked with the INTERVAL form of the second argument, ADDDATE() is a synonym for DATE_ADD(). The related function SUBDATE() is a synonym for DATE_SUB(). For information on the INTERVAL unit argument, see the discussion for DATE_ADD().

When invoked with the days form of the second argument, MariaDB treats it as an integer number of days to be added to expr.

Examples

SELECT DATE_ADD('2008-01-02', INTERVAL 31 DAY);
+-----------------------------------------+
| DATE_ADD('2008-01-02', INTERVAL 31 DAY) |
+-----------------------------------------+
| 2008-02-02                              |
+-----------------------------------------+

SELECT ADDDATE('2008-01-02', INTERVAL 31 DAY);
+----------------------------------------+
| ADDDATE('2008-01-02', INTERVAL 31 DAY) |
+----------------------------------------+
| 2008-02-02                             |
+----------------------------------------+

This page is licensed: GPLv2, originally from fill_help_tables.sql

Last updated

Was this helpful?