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

# Difference Between Dates

> Calculate difference between two dates

## Overview

The `diff-dates` transformation calculates the difference between two dates.

## Syntax

```text theme={"theme":{"light":"github-light","dark":"github-dark"}}
diff-dates(<variable 1>, <variable 2>, unit="days")
```

## Parameters

| Parameter     | Type   | Required | Description                                                                                                   |
| ------------- | ------ | -------- | ------------------------------------------------------------------------------------------------------------- |
| `variable 1`  | date   | Yes      | First date                                                                                                    |
| `variable 2`  | date   | Yes      | Second date                                                                                                   |
| `unit`        | string | No       | Unit of difference: `"milliseconds"`, `"seconds"`, `"minutes"`, `"hours"`, `"days"`, `"months"`, or `"years"` |
| `inputLocale` | string | No       | Locale used to parse the input dates: `"pt"`, `"nl"`, `"en"`, `"de"`, `"ja"`, `"zh"`, or `"fr"`               |

## Examples

```text theme={"theme":{"light":"github-light","dark":"github-dark"}}
diff-dates(<variable 1>, <variable 2>, unit="days")
diff-dates(<variable 1>, <variable 2>, unit="hours")
diff-dates(<variable 1>, <variable 2>, unit="seconds", inputLocale="fr")
```
