The DATEDIF() function is a useful utility for easily calculating the time difference between two dates (a period).
The syntax for the DATEDIF() function is as follows
This article explains how to use the DATEDIF() function
The DATEDIF() function is a useful utility for easily calculating the time difference between two dates (a period).
The syntax for the DATEDIF() function is as follows
FSDATEDIF(date1, date2, timeframe)
date1
is the starting date of the perioddate2
is the ending date of the periodtimeframe
a letter code representing the type of differenceWhere timeframe
can be any of the following codes.
D
gets the number of complete days in the periodM
gets the number of complete months in the periodY
gets the number of complete years in the periodMD
gets the difference in days disregarding months and yearsYM
gets the difference in months, disregarding days and yearsYD
gets the difference in days, disregarding monthsNOTE: timeframe
is not case sensitive.
FSDATEDIF(01/01/2001, 01/01/2002, "D") = 365 DATEDIF(01/01/2001, 01/01/2002, "M") = 12 DATEDIF(01/01/2001, 01/01/2002, "Y") = 1 DATEDIF(01/01/2001, 30/06/2002, "MD") = 29 DATEDIF(01/01/2001, 30/06/2002, "YM") = 5 DATEDIF(01/01/2001, 30/06/2002, "YD") = 180
Learn more about datedif in one of the following articles