MySQL ADDDATE Function

MySQL ADDDATE function is a Synonym of the DATE_ADD. This Date Function 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 basic syntax of the ADDDATE() Function 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 ADDDATE function. 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 Function article in MySQL to understand the Units after the Interval. And also refer DATE_ADD Function.

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);
MySQL ADDDATE Function 1

In this ADDDATE function example, we added 5 Quarters to a given Datetime expression. Next, added 4 Years. In the last Data functions 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);
MySQL ADDDATE Function 2