ADD()
All functions > DATE AND TIME > ADD()
Returns the date/timestamp after adding an interval.
Signatures
Temporal addition
Returns: Timestamp after adding the interval
ADD(timestamp: TIMESTAMP, interval: INTERVAL) → TIMESTAMP sql
| Parameter | Type | Required | Description |
|---|---|---|---|
timestamp | TIMESTAMP | Yes | Timestamp to add to |
interval | INTERVAL | Yes | Interval to add |
Signature notes:
- Supports adding intervals to dates and timestamps
- Returns NULL if either operand is NULL
Related operators
Examples
ADD(...)
FeatureQL
SELECT
-- Function call
f1 := ADD(1, 2)
;Result
| f1 BIGINT |
|---|
| 3 |
.ADD(...) — chained
FeatureQL
SELECT
-- Integer literal: wrap in parentheses so `.ADD` applies to the value, not to the digit sequence
f1 := (1).ADD(2),
-- Decimal base: chain without extra parentheses
f2 := 1.0.ADD(2),
-- Fold left via chained `.ADD`
f3 := (1).ADD(2).ADD(3)
;Result
| f1 BIGINT | f2 VARCHAR | f3 BIGINT |
|---|---|---|
| 3 | 3.0 | 6 |
Date and time
FeatureQL
SELECT
-- Chained add on a timestamp
f1 := TIMESTAMP '2021-01-01'.ADD(INTERVAL '1 DAY'),
-- Parsed duration
f2 := TIMESTAMP '2025-09-01 12:00:00'.ADD(
INTERVAL_PARSE('2 hours 30 minutes')
)
;Result
| f1 TIMESTAMP | f2 TIMESTAMP |
|---|---|
| 2021-01-02T00:00:00 | 2025-09-01T14:30:00 |
Edge cases
FeatureQL
SELECT
-- DECIMAL addition
f1 := ADD(1.0, 2.0),
-- DOUBLE addition
f2 := ADD(1e0, 2e0),
-- Negative right operand
f3 := ADD(10, -3)
;Result
| f1 VARCHAR | f2 VARCHAR | f3 BIGINT |
|---|---|---|
| 3.0 | 3.0 | 7 |