ADDDATE
ADDDATE is a SQL function used to add a specific number of days, months, or years to a given date, resulting in a new date value.
ADDDATE(date, INTERVAL expr unit)
- date: The original date value from which the function will add a specified amount of time. This parameter may also be a datetime or a timestamp value.
- interval expr unit: A combination of two values - ‘expr’ and ‘unit’. ‘expr’ is the amount of interval to add. ‘unit’ is the type of interval to add and can be 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.
Example
Output
Explanation
In the example, ADDDATE
function adds 5 days to the given date ‘2020-12-31’. The result is ‘2021-01-05’.