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

# DATE_DIFF

Calculates the difference between `start_timestamp` and `end_timestamp` by the indicated unit.

## Syntax

```sql theme={"theme":{"light":"css-variables","dark":"css-variables"}}
DATE_DIFF('<unit>', <start_timestamp>, <end_timestamp>)
```

## 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`. |
| `<start_timestamp>` | A value expression evaluating to a `TIMESTAMP` or `TIMESTAMPTZ` value.                                                                                                                             |
| `<end_timestamp>`   | A value expression evaluating to a `TIMESTAMP` or `TIMESTAMPTZ` value.                                                                                                                             |

## Return Type

`BIGINT`

## Example

<div className="query-window">
  ```
  SELECT DATE_DIFF('day', '2024-01-01'::TIMESTAMP, '2024-04-15'::TIMESTAMP);
  ```

  | date\_diff <span>long</span> |
  | :--------------------------- |
  | 105                          |

  <p><span>Rows: 1</span><span>Execution time: 4.46ms</span></p>
</div>
