Syntax
Syntax 1
ADDDATE(date, INTERVAL expr unit)
Syntax 2
ADDDATE(expr, days)
Purpose
- The first declaration of this function is a synonym for
DATE_ADD(), which adds a specified time interval to the date valuedate. For more information about theunitparameter, see DATE_ADD. - The second declaration of this function adds
daysto the date specified byexpr.
Notice
This function is a ClickHouse-compatible function. By default, it is disabled. You must set the sql_func_extension_mode parameter to enable it. For more information, see sql_func_extension_mode.
Examples
Enable the ClickHouse extension function mode.
obclient> ALTER SYSTEM SET sql_func_extension_mode = "ClickHouse";Add 3 days to the specified date.
obclient> SELECT ADDDATE('2026-03-30', 3);The return result is as follows:
+--------------------------+ | ADDDATE('2026-03-30', 3) | +--------------------------+ | 2026-04-02 00:00:00.000 | +--------------------------+ 1 row in setAdd 1 hour and 30 minutes to the specified date and time.
obclient> SELECT ADDDATE('2026-03-30 10:00:00', INTERVAL 90 MINUTE);The return result is as follows:
+----------------------------------------------------+ | ADDDATE('2026-03-30 10:00:00', INTERVAL 90 MINUTE) | +----------------------------------------------------+ | 2026-03-30 11:30:00.000 | +----------------------------------------------------+ 1 row in set
