Spread Formula Reference
DATEDIF
Formula Functions > Functions D to G > DATEDIF

This function returns the number of days, months, or years between two dates.

Syntax

DATEDIF(date1,date2,outputcode)

Arguments

The first two arguments are any dates, as strings, numeric values, or DateTime objects.

The output codes are:

Code Description
"D" The number of days between date1 and date2
"M" The number of complete months between date1 and date2
"Y" The number of complete years between date1 and date2
"YD" The number of days between date1 and date2 as if they were in the same year
"YM" The number of months between date1 and date2 as if they were in the same year
"MD" The number of days between date1 and date2 as if they were in the same month and year

Data Types

Accepts strings, numeric values, and DateTime objects. Strings and numbers are converted to DateTime objects.

Examples

DATEDIF(A1,B1,C1)

DATEDIF(R1C1,R1C2,R1C3)

DATEDIF("2001/1/1","2003/1/1","Y")

Version Available

This function is available in product version 2.0 or later.

See Also

DATEVALUE | TIME | Date and Time Functions