Increase a date by 10 days and provide the resulting date.
SELECT ADDDATE(“2017-06-15”, INTERVAL 10 DAY); |
The ADDDATE() function adds a time/date interval to a given date and subsequently returns the resulting date.
ADDDATE(date, INTERVAL value addunit) |
OR:
ADDDATE(date, days) |
Parameter |
Description |
date |
Mandatory: The date for adjustment |
days |
Mandatory: The number of days to add to the date |
value |
Mandatory: The value of the time/date interval to be added. Both positive and negative values are accepted. |
addunit |
Mandatory: The type of interval to add. Options include:
|
Works in: |
From MySQL version 4.0 |
Add 15 minutes to a given date and return the new date.
SELECT ADDDATE(“2017-06-15 09:34:21”, INTERVAL 15 MINUTE); |
Subtract 3 hours from a given date and return the new date.
SELECT ADDDATE(“2017-06-15 09:34:21”, INTERVAL –3 HOUR); |
Subtract 2 months from a given date and return the new date.
SELECT ADDDATE(“2017-06-15”, INTERVAL –2 MONTH); |