Add 10 days to a given date and return the resulting date.
SELECT DATE_ADD(“2017-06-15”, INTERVAL 10 DAY); |
The DATE_ADD() function adds a time or date interval to a given date and returns the resulting date.
DATE_ADD(date, INTERVAL value addunit) |
Parameter |
Description |
date |
Specify the date to be adjusted. |
value |
Specify the value of the time or date interval to be added. Both positive and negative values are accepted. |
addunit |
Specify the type of interval to be added. It can be one of the following values:
|
Works in: |
From MySQL version 4.0 |
Add a duration of 15 minutes to a given date and return the resulting date.
SELECT DATE_ADD(“2017-06-15 09:34:21”, INTERVAL 15 MINUTE); |
Subtract a duration of 3 hours from a given date and return the resulting date.
SELECT DATE_ADD(“2017-06-15 09:34:21”, INTERVAL –3 HOUR); |
Subtract a duration of 2 months from a given date and return the resulting date.
SELECT DATE_ADD(“2017-06-15”, INTERVAL –2 MONTH); |