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

> Reference material for DATE_ADD function

# DATE_ADD

export const QueryWindow = ({content}) => {
  const {sql, result} = content;
  const [inited, setInited] = useState(false);
  const buttonRef = useRef(null);
  useEffect(() => {
    if (!inited && buttonRef.current) {
      runQuery(buttonRef.current, true);
      setInited(true);
    }
  }, []);
  return <div className="query-window">
      <div className="query-toolbar">
        <button className="run-button" onClick={ev => runQuery(ev.target)} ref={buttonRef}>Run Query</button>
        <span className="window-title">Interactive SQL Playground 🔥</span>
      </div>
      <div className="query-content">
        <pre><code className="firebolt-sql language-sql" contentEditable="true" spellCheck="false" data-original-query={sql}>{sql}</code></pre>
        <script type="application/json" className="fallback-result" style={{
    display: "none"
  }}>{JSON.stringify(result)}</script>
        <div className="server-unavailable-banner query-window-hidden">
          The Firebolt playground server is currently unavailable. Using precomputed query results.
        </div>
        <div className="query-results"></div>
      </div>
    </div>;
};

Computes a new TIMESTAMP or TIMESTAMPTZ value by adding or subtracting a specified number of time units from a DATE, TIMESTAMP, or TIMESTAMPTZ value.
It's similar to [arithmetic with intervals](/reference-sql/lexical-structure/operators#arithmetic-with-date%2Ftime-and-intervals), but it also allows using a column reference for the `<quantity>`.

## Syntax

```sql theme={"theme":{"light":"github-light","dark":"github-dark"}}
DATE_ADD('<unit>', <quantity>, <expression>)
```

## Parameters

| Parameter      | Description                                                                                                                                                                             |
| :------------- | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `<unit>`       | A TEXT literal specifying the time unit. Must be one of `microsecond`,`millisecond`,`second`,`minute`,`hour`,`day`,`week`,`month`,`quarter`,`year`,`decade`,`century`, or `millennium`. |
| `<quantity>`   | An INT or BIGINT specifying how often the time unit should be added or subtracted to `<expression>`.                                                                                    |
| `<expression>` | An expression evaluating to type DATE, TIMESTAMP, or TIMESTAMPTZ.                                                                                                                       |

## Return Types

TIMESTAMP if `<expression>` has type DATE or TIMESTAMP.
TIMESTAMPTZ if `<expression>` has type TIMESTAMPTZ.

## Example

<QueryWindow
  content={{
"sql": "SELECT date_add('week', 4, '2024-04-15 12:13:14'::timestamp);",
"result": {
"data": [
  [
    "2024-05-13 12:13:14"
  ]
],
"meta": [
  {
    "name": "?column?",
    "type": "timestamp"
  }
],
"query": {
  "query_id": "2c942591-d3e9-4a9b-96b3-5af2e308b638",
  "query_label": null,
  "request_id": "ad5a5e9a-981a-4163-86e2-586a4a7b02ae"
},
"rows": 1,
"statistics": {
  "bytes_read": 1,
  "elapsed": 0.007117,
  "rows_read": 1,
  "scanned_bytes_cache": 0,
  "scanned_bytes_storage": 0,
  "time_before_execution": 0.000267803,
  "time_to_execute": 8.1447e-05
}
}
}}
/>
