> ## Documentation Index
> Fetch the complete documentation index at: https://docs.e6data.com/llms.txt
> Use this file to discover all available pages before exploring further.

# DATEADD

> Adds a specified number of units to a date or timestamp.

<div className="e6-meta"><span className="e6-eyebrow e6-eyebrow--quiet">Scalar function</span></div>

**Aliases:** [`date_add`](/query/sql/functions/date-time/date_add)

NULL amount or date/timestamp input returns NULL. Values outside the supported range can raise an error.

## Syntax

### Dateadd units (scalar)

```sql theme={"theme":{"light":"github-light","dark":"github-dark"}}
dateadd(unit, amount, value)
```

* DATEADD uses a unit keyword such as DAY; do not quote it as a STRING literal.

## Arguments

| Name | Type | Required | Description |
| - | - | - | - |
| unit | Unquoted unit keyword | Yes | Unit to add. year/y/yy/yyy/yyyy/yr/years/yrs; quarter/q/qq/qtr/qtrs/quarters; month/m/mm/mon/mons/months; week/w/wk/weeks/weekofyear/woy/wy; day/d/dd/days/dayofmonth/dayofyear/doy; hour/h/hh/hr/hours/hrs; minute/mi/min/minutes/mins; second/s/ss/sec/seconds/secs; millisecond/ms/milliseconds; microsecond/us/microseconds. Case-insensitive. Write an unquoted unit keyword, for example DAY, in this calling form. A quoted STRING or arbitrary expression is not accepted by this spelling. Must be a constant argument. |
| amount | TINYINT, SMALLINT, INTEGER, BIGINT, FLOAT, DOUBLE or DECIMAL(p, s) | Yes | Signed amount, converted to BIGINT before addition. Fractional parts are discarded toward zero. The converted amount must fit BIGINT. For DECIMAL(p, s), p is precision (total digits) and s is scale (digits after the decimal point). |
| value | DATE or TIMESTAMP | Yes | Temporal starting value. |

## Returns

* Type: TIMESTAMP
* NULL behavior: NULL amount or date/timestamp input returns NULL. Values outside the supported range can raise an error.

## Properties

| Property | Value |
| - | - |
| Deterministic | Yes |
| Exact result | Yes |

## Units

* Input unit: The unit keyword in the first argument
* Output unit: Temporal value

## Usage notes

* In the three-argument form, numeric amounts are converted to BIGINT before addition. Fractional amounts are truncated toward zero: 1.9 adds one unit, and -1.9 subtracts one unit.
* DATE input in the three-argument form becomes a midnight TIMESTAMP, so hours and smaller units can change its time of day.
* TIME inputs are not accepted by these calling forms. Use a DATE or TIMESTAMP value.
* INTEGER and INT mean the same type; STRING means VARCHAR text. NULL can be used with a supported type. Cast NULL explicitly when its type would otherwise be unclear.

## Examples

### Alias calling form: DATEADD

```sql theme={"theme":{"light":"github-light","dark":"github-dark"}}
SELECT dateadd(DAY,1,TIMESTAMP '2024-01-01 10:30:00') AS result;
```

| result |
| - |
| 2024-01-02 10:30:00 |

Fractional amounts are truncated toward zero:

```sql theme={"theme":{"light":"github-light","dark":"github-dark"}}
WITH t(amount) AS (VALUES (CAST(1.9 AS DOUBLE)), (CAST(-1.9 AS DOUBLE))) SELECT amount, dateadd(DAY, amount, DATE '2024-01-10') AS result FROM t ORDER BY amount;
```

| amount | result |
| - | - |
| -1.9 | 2024-01-09 00:00:00 |
| 1.9 | 2024-01-11 00:00:00 |

## Limitations

* The three-argument form returns TIMESTAMP, including for a DATE input.
* Amounts must fit BIGINT after conversion, and the resulting date or timestamp must remain within its supported range. Do not rely on NULL being returned for overflow.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.