Skip to content

datedif

Difference between two dates in a chosen unit.

v = datedif(start_date, end_date, unit)

Returns the elapsed time between start_date and end_date in the requested unit:

  • 'Y' — complete years
  • 'M' — complete months
  • 'D' — days
  • 'YM' — months ignoring years
  • 'YD' — days ignoring years
  • 'MD' — days ignoring years and months
datedif(date(2020,1,1), date(2026,4,28), 'Y') % 6
  • days — Number of days between two dates.
  • yearfrac — Fraction of a year between two dates.
  • edate — Date offset by a number of months.