> ## 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.

# DATE_ADD

> Adds calendar days or specified temporal units.

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

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

NULL inputs return NULL. Values outside the supported range can raise an error.

## Syntax

### Days (scalar)

```sql theme={"theme":{"light":"github-light","dark":"github-dark"}}
date_add(date, days)
```

### Units (scalar)

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

### 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

### Days

| Name | Type | Required | Description |
| - | - | - | - |
| date | DATE | Yes | Starting date. |
| days | INTEGER | Yes | Signed day count. |

### Units

| Name | Type | Required | Description |
| - | - | - | - |
| unit | STRING | 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. |
| 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. |

### Dateadd units

| 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: DATE for the two-argument form; TIMESTAMP for the three-argument form, including when value is DATE.
* NULL behavior: NULL inputs return NULL. Values outside the supported range can raise an error.

### Days

* Type: DATE
* NULL behavior: NULL value or amount yields NULL; arithmetic overflow errors.

## Properties

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

## Units

* Input unit: Signed calendar day count or specified temporal units
* Output unit: Temporal value

## Usage notes

* Two arguments always operate in the DATE domain.
* 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

### Basic example

```sql theme={"theme":{"light":"github-light","dark":"github-dark"}}
SELECT date_add(DATE '2024-01-15',5) AS result;
```

| result |
| - |
| 2024-01-20 |

### 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.