# DATEDIF

datetime · from excel · excel: not yet compared · sheets: not yet compared

calculates difference between two dates

## signature

```
DATEDIF(start_date, end_date, unit)
```

returns: `number`

## arguments

- start_date: number — required
- end_date: number — required
- unit: text — required

## examples

formula and result, asserted in the engine test suite.

| formula | result | with |
| --- | --- | --- |
| `=DATEDIF(DATE(2020,1,1), DATE(2026,7,27), "Y")` | `6` | — |

## errors

error values observed from the engine — each with a call that produces it.

| error | produced by |
| --- | --- |
| `#VALUE!` | `=DATEDIF(DATE(2026,1,15), DATE(2026,1,15), 2)` |

## related

- [DATE](https://deepcalc.com/functions/date.md) — creates date from year, month, day
- [DATEVALUE](https://deepcalc.com/functions/datevalue.md) — converts date text to serial number
- [DAY](https://deepcalc.com/functions/day.md) — returns day of month from date
- [DAYS](https://deepcalc.com/functions/days.md) — returns number of days between two dates
- [DAYS360](https://deepcalc.com/functions/days360.md) — returns days between dates on 360-day year
- [EDATE](https://deepcalc.com/functions/edate.md) — returns date shifted by given months
- [EOMONTH](https://deepcalc.com/functions/eomonth.md) — returns last day of month after offset
- [EPOCHTODATE](https://deepcalc.com/functions/epochtodate.md) — converts a unix timestamp to a date serial

## navigate

- [all datetime functions](https://deepcalc.com/functions/datetime-functions.md)
- [function index](https://deepcalc.com/functions.md) — all 600 functions
- [error values](https://deepcalc.com/errors.md) · [concepts](https://deepcalc.com/concepts.md) · [limits](https://deepcalc.com/limits.md)
- [everything in one file](https://deepcalc.com/llms-full.txt)

source: https://deepcalc.com/functions/datedif