This function returns the number of days, months, or years between two dates.
DATEDIF(date1,date2,outputcode)
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 |
Accepts strings, numeric values, and DateTime objects. Strings and numbers are converted to DateTime objects.
DATEDIF(A1,B1,C1)
DATEDIF(R1C1,R1C2,R1C3)
DATEDIF("2001/1/1","2003/1/1","Y")
This function is available in product version 2.0 or later.
DATEVALUE | TIME | Date and Time Functions