ADDDATE() FUNCTION The MySQL ADDDATE function gets a date value after adding a certain time/date interval. The various versions of MySQL support the ADDDATE function, namely, MySQL 5.7, MySQL 5.6, MySQL 5.5, MySQL 5.1, MySQL 5.0, MySQL 4.1, MySQL 4.0, and MySQL 3.23.
Syntax:
ADDDATE( date, INTERVAL value unit )
OR
ADDDATE( date, days )
Parameters: date: It is used to specify the date to which the interval should be added. days: It is used to specify the number of days to add to the date. value: It is used to specify the time/date interval value to be added. unit: It is used to specify the unit type of the interval such as DAY, MONTH, MINUTE, etc.
Example 1:
mysql> SELECT ADDDATE ('2019-07-05', INTERVAL 5 DAY);
Output:
'2019-07-10'
Explanation: The desired date interval has been added to the start value of the date.
Example 2:
mysql> SELECT ADDDATE ('2019-07-05 15:30:20', INTERVAL -15 SECOND);
Output:
'2019-07-05 15:30:05'
Explanation: The desired time interval has been added to the start value of the date.