Skip to main content
Workday User Guide
Last Updated: 2023-06-23
DATEDIF

DATEDIF

Description

Returns the number of days, months, or years between two dates, based on the specified unit. We provide DATEDIF for compatibility but it calculates incorrect results in some situations. We strongly recommend using WD.DATEDIF for more accurate results.

Syntax

DATEDIF(
start_date
,
end_date
,
unit
)
  • start_date
    : The starting date for the count. Workday recommends using a cell reference to specify the date instead of entering the date as text, to ensure reliable results.
  • end_date
    : The ending date for the count. Workday recommends using a cell reference to specify the date instead of entering the date as text, to ensure reliable results.
  • unit
    : The 1- or 2-character code specifying the information to include in the result. The value is case-sensitive.
    Code
    Returns
    Y
    The number of complete years in the period.
    M
    The number of complete months in the period.
    D
    The number of days in the period.
    MD
    The difference between the days in start_date and end_date. The function ignores the months and years of the dates.
    YM
    The difference between the months in start_date and end_date. The function ignores the days and years of the dates.
    YD
    The difference between the days of start_date and end_date. The function ignores the years of the dates.

Example

Formula
Result
=DATEDIF("01-Jan-2015", "10-Jan-2015", "D")
9
=DATEDIF("14-Jul-2016", "01-Dec-2016", "YM")
5