DATEDIF

Calculates the number of days, months, or years between two dates.

Parameter List

Syntax
DATEDIF(start_dateend_dateunit)
start_date

The start date to consider in the calculation. For example: 2022-02-16.

end_date

The end date to consider in the calculation. For example, 2026-08-27.

unit

The start of the date range. Accepted values are:

  • 'Y' which returns the difference in years
  • 'M' which returns the difference in months
  • 'D' which returns the difference in days
  • 'MD' which returns the difference in days excluding months
  • 'YM' which returns the difference in months excluding years and
  • 'YD' which returns the difference in days excluding years.

Examples

DATEDIF("2022-02-16", "2022-04-19", "D") returns 62