MySQL ADDDATE() Function
MySQL ADDDATE(): Shift Dates Forward by Days or Intervals
The ADDDATE() function moves a DATE or DATETIME value forward by a specified interval or integer day count. Unlike DATE_ADD(), ADDDATE() offers a compact two-argument form when you only need to add whole days.
Teams use ADDDATE() to calculate invoice due dates, shipping windows, and trial expiration dates directly in SQL queries.
Syntax
ADDDATE() accepts either a standard INTERVAL clause or a plain integer representing days:
ADDDATE(date_value, INTERVAL expr unit)
ADDDATE(date_value, days)
date_value: ADATE,DATETIME, or valid date string such as'2026-05-12'.INTERVAL expr unit: Works identically toDATE_ADD(), supporting units likeDAY,WEEK,MONTH,YEAR, andHOUR.days: An integer value added as days. Negative numbers move the date backward.
Practical Example
Suppose your fulfillment team calculates an estimated delivery date by adding 5 days to each row in demo_orders, alongside a 30-day return deadline.
SELECT
order_id,
customer_id,
order_date,
ADDDATE(order_date, 5) AS estimated_delivery,
ADDDATE(order_date, INTERVAL 1 MONTH) AS return_deadline
FROM demo_orders
WHERE order_id IN (101, 102, 103);
| order_id | customer_id | order_date | estimated_delivery | return_deadline |
|---|---|---|---|---|
| 101 | 14 | 2026-01-31 | 2026-02-05 | 2026-02-28 |
| 102 | 29 | 2026-03-14 | 2026-03-19 | 2026-04-14 |
| 103 | 42 | 2026-05-01 | 2026-05-06 | 2026-06-01 |
Notice row 101: adding INTERVAL 1 MONTH to 2026-01-31 clamps safely to 2026-02-28 instead of overflowing into March.
Common Mistakes & NULL Behavior
Watch out for these subtle issues when calling ADDDATE() in production queries:
- Invalid calendar dates return
NULL: Passing'2026-02-30'or'2026-04-31'makesADDDATE()returnNULL, even with a valid day offset. - Any
NULLinput yieldsNULL: If either the date column or the day offset evaluates toNULL, the output becomesNULL. - Mixing up time units: Passing an integer shorthand like
ADDDATE(order_date, 2)always means 2 days, never 2 hours or 2 months. - Unindexed
WHEREcomparisons: CallingADDDATE(order_date, 7) > CURDATE()prevents MySQL from using an index onorder_date. Rewrite it asorder_date > SUBDATE(CURDATE(), 7).
Frequently Asked Questions
What is the difference between ADDDATE() and DATE_ADD() in MySQL?
When you write INTERVAL expr unit, ADDDATE() and DATE_ADD() behave identically. However, ADDDATE() also supports the shorthand ADDDATE(date, days) without the INTERVAL keyword, while DATE_ADD() throws a syntax error without INTERVAL.
Can ADDDATE() subtract days from a date?
Yes. Pass a negative integer such as ADDDATE('2026-05-12', -7) or a negative interval like INTERVAL -7 DAY. Both return '2026-05-05'.
Does ADDDATE() preserve the time component of a DATETIME?
Yes. Adding days or months to a DATETIME keeps the original HH:MM:SS intact, and adding HOUR or MINUTE updates both date and time.
Unlock Your
Full Potential.
Sign in to track your learning journey, earn industry-recognized certificates, and join our elite developer community.
Quick Access With
Try it Yourself
Experiment with the code from this lesson in our interactive playground.