Home »
MySQL »
MySQL date/time Functions
MySQL DATE_ADD() Function
MySQL | DATE_ADD() Function: Learn about the DATE_ADD() function, how it works, its usages, syntax, and examples.
Submitted by Apurva Mathur, on September 27, 2022
DATE_ADD() Function
DATE_ADD() function, adds an interval to some date and as a result, it will return you the date in the particular interval.
There are different types of intervals that we can add to this function, which are as follows,
- MICROSECOND
- SECOND
- MINUTE
- HOUR
- DAY
- WEEK
- MONTH
- QUARTER
- YEAR
- SECOND_MICROSECOND
- MINUTE_MICROSECOND
- MINUTE_SECOND
- HOUR_MICROSECOND
- HOUR_SECOND
- HOUR_MINUTE
- DAY_MICROSECOND
- DAY_SECOND
- DAY_MINUTE
- DAY_HOUR
- YEAR_MONTH
DATE_ADD() Syntax
SELECT DATE_ADD (DATE, INTERVAL VALUE UNIT);
DATE_ADD() Parameter(s)
- DATE: Date in the format 'yyyy:dd:mm' in which the particular interval will be added.
- INTERVAL VALUE: This is the numeric value that can normally be called duration. Where UNIT is the type of interval you want to apply on your date.
DATE_ADD() Return Value
It will return the date after applying the interval value you have provided.
MySQL DATE_ADD() Function Example 1
SELECT DATE_ADD("2001-07-11", INTERVAL 40 DAY);
Output:
MySQL DATE_ADD() Function Example 2
SELECT DATE_ADD ("2001-07-11", INTERVAL 4 YEAR);
Output:
MySQL DATE_ADD() Function Example 3
SELECT DATE_ADD("2001-02-19 12:24:26",INTERVAL 30 MINUTE);
Output: