DATE_ADD

All functions > DATE AND TIME > DATE_ADD

Returns the date/timestamp after adding a given number of a given units to the given date/timestamp.

Signatures

Returns: A new timestamp with the interval added

DATE_ADD(timestamp: TIMESTAMP, unit: VARCHAR, value: BIGINT) → TIMESTAMP
sql
ParameterTypeRequiredDescription
timestampTIMESTAMPYesThe base timestamp
unitVARCHARYesThe time unit to add (e.g., 'day', 'hour', 'month')
valueBIGINTYesThe number of units to add

Notes

  • Adds a specified interval to a timestamp
  • Common units: 'second', 'minute', 'hour', 'day', 'week', 'month', 'year'
  • Value can be positive (future) or negative (past)
  • Useful for date arithmetic and scheduling
  • Handles month/year boundaries correctly

Examples

FeatureQL
SELECT
    f1 := DATE_ADD(TIMESTAMP '2024-03-15 10:00:00', 'day', 7),  -- Add 7 days
    f2 := DATE_ADD(TIMESTAMP '2024-03-15 10:00:00', 'hour', 3),  -- Add 3 hours
    f3 := DATE_ADD(TIMESTAMP '2024-03-15 10:00:00', 'month', -1)  -- Subtract 1 month
;
Result
f1 TIMESTAMPf2 TIMESTAMPf3 TIMESTAMP
2024-03-22T10:00:002024-03-15T13:00:002024-02-15T10:00:00

Last update at: 2026/03/03 16:47:38
Last updated: 2026-03-03 16:48:19