# DATE\_ADD

Aggiunge un intervallo di un'unità specificata a un dato timestamp. La sottrazione può essere eseguita utilizzando un valore di intervallo negativo.

## Sintassi

```
DATE_ADD(UNIT, VALUE, TIMESTAMP)
```

## Argomenti

#### UNIT

Tipo: `string`

L'unità di tempo da aggiungere.

Può essere una delle seguenti:

* `year`
* `quarter`
* `month`
* `week`
* `day`
* `hour`
* `minute`
* `second`
* `millisecond`

#### VALUE

Tipo: `bigint`

Il valore intero di `UNIT` da aggiungere a `TIMESTAMP`.

Può essere positivo (per tempi futuri) o negativo (per tempi passati).

#### TIMESTAMP

Tipo: `timestamp`

Il timestamp da modificare.

## Restituisce

Tipo: `timestamp`

Il `TIMESTAMP` a cui è stato aggiunto un `INTERVAL` del `NUMBER` specificato.

***

## Esempi

| UNITÀ | VALORE | TIMESTAMP | Output |
| --- | --- | --- | --- |
| giorno | 1 | `2001-08-22 03:04:05.321` | `2001-08-23 03:04:05.321` |
| anno | 5 | `2001-08-22 03:04:05.321` | `2006-08-22 03:04:05.321` |
| secondo | 30 | `2001-08-22 03:04:05.321` | `2001-08-22 03:04:35.321` |
| trimestre | 1 | `2001-08-22 03:04:05.321` | `2001-11-22 03:04:05.321` |
| trimestre | -1 | `2001-08-22 03:04:05.321` | `2001-05-22 03:04:05.321` |
| trimestre | 0 | `2001-08-22 03:04:05.321` | `2001-08-22 03:04:05.321` |
| anno | 1 | `null` | `null` |