MySQL ADDDATE function is a Synonym of the DATE_ADD. This method adds the specified intervals to the given date & time and returns the date or DateTime.
In this section, we show you how to use this MySQL ADDDATE function to add specified intervals to a date expression with an example. The syntax is as shown below:
ADDDATE(Date, INTERVAL expression Unit);
MySQL ADDDATE function Example
The following are the list of examples that help you understand the use of this method. In this example, First, we are adding 31 days to a given Datetime expression. Next, we added 16 Weeks. Within the third statement, we added 18 Months to that Date.
TIP: I suggest you refer to the Date article in MySQL to understand the Units after the Interval. And also, refer to DATE_ADD.
SELECT ADDDATE('2019-02-28 23:59:59', INTERVAL 31 DAY);
SELECT ADDDATE('2019-02-28 23:59:59', INTERVAL 16 WEEK);
SELECT ADDDATE('2019-02-28 23:59:59', INTERVAL 18 MONTH);
In this ADDDATE example, we added 5 Quarters to a given Datetime expression. Next, added 4 Years. In the last statement, we added 12 Years and 8 Months to the given DateTime value.
SELECT ADDDATE('2019-02-28 23:59:59', INTERVAL 5 QUARTER);
SELECT ADDDATE('2019-02-28 23:59:59', INTERVAL 4 YEAR);
SELECT ADDDATE('2019-02-28 23:59:59', INTERVAL '12-10' YEAR_MONTH);