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

# TIMESTAMP_ADD

> Adds a signed duration or calendar interval to a timestamp.

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

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

Returns NULL if amount or value is NULL.

## Syntax

### Scalar

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

### Timestampadd units (scalar)

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

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

## Arguments

### Scalar

| Name | Type | Required | Description |
| - | - | - | - |
| unit | STRING constant | Yes | A supported, non-NULL constant unit. Case-insensitive singular/plural microsecond, millisecond, second, minute, hour, day, week, month, quarter and year. Must be a constant argument. |
| amount | INTEGER or BIGINT | Yes | Signed number of units. For months, quarters or years, the absolute amount multiplied by 1, 3 or 12 must not exceed 4294967295 months. Other units raise an error if the calculation overflows. |
| value | TIMESTAMP | Yes | Starting timestamp. TIMESTAMP with microsecond precision; timestamps with a negative fractional number of seconds since 1970-01-01 00:00:00 UTC are excluded for month/quarter/year forms. Calendar operations use the stored UTC clock, not timezone-local calendar boundaries. |

### Timestampadd units

| Name | Type | Required | Description |
| - | - | - | - |
| unit | Unquoted unit keyword | Yes | A supported, non-NULL constant unit. Case-insensitive singular/plural microsecond, millisecond, second, minute, hour, day, week, month, quarter and year. 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 | INTEGER or BIGINT | Yes | Signed number of units. For months, quarters or years, the absolute amount multiplied by 1, 3 or 12 must not exceed 4294967295 months. Other units raise an error if the calculation overflows. |
| value | TIMESTAMP | Yes | Starting timestamp. TIMESTAMP with microsecond precision; timestamps with a negative fractional number of seconds since 1970-01-01 00:00:00 UTC are excluded for month/quarter/year forms. Calendar operations use the stored UTC clock, not timezone-local calendar boundaries. |

## Returns

* Type: TIMESTAMP, preserving the input’s time zone
* NULL behavior: Returns NULL if amount or value is NULL.

## Properties

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

## Usage notes

* Supported singular/plural units: year, quarter, month, week, day, hour, minute, second, millisecond, microsecond.
* Month/quarter/year operations use calendar-month arithmetic; shorter units use fixed microsecond durations.
* Numeric amounts are converted to BIGINT. Fractional amounts follow BIGINT conversion rules; the function does not preserve fractional units.

## Examples

### Basic example

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

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

### Alias calling form: TIMESTAMPADD

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

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

## Limitations

* Do not use month, quarter or year units with timestamps before 1970-01-01 00:00:00 UTC that include fractional seconds. Those inputs can produce an incorrect calendar result.
* Keep month totals within the stated limits. Larger totals can produce incorrect results without an error.
* Fixed-duration calculations raise an error on overflow. Within the month-count limits, invalid calendar results also raise an error. Larger month counts can produce an incorrect result without an error or NULL.


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