Documentation/Calc Functions/DATEDIF/en

Function name:
DATEDIF

Category:
Date and Time

Summary:
Determines the difference between two given dates, returning the result in days, months, or years as specified in the third argument.

Syntax:
DATEDIF(Start date; End date; Interval)

Returns:
Returns a non-negative integer which is the difference between the two given dates in days, months, or years (as specified in the Interval argument).

Arguments:
Start date is the date (in quotation marks) or a date-time serial number, or a reference to the cell containing one of those types, which is the start date of the period for which the calculation is to be carried out.

End date is the date (in quotation marks) or a date-time serial number, or a reference to the cell containing one of those types, which is the end date of the period for which the calculation is to be carried out. End date must not be earlier than Start date.

Interval is a string, or a reference to a cell containing that string, which determines which result is returned. The accepted strings are listed in the following table and they are not case sensitive (so, for example, "d" and "D" are equivalent).


 * If either Start date or End date is not a valid date expression, then DATEDIF reports an invalid argument error (Err:502).
 * If Start date is later than End date, then DATEDIF reports an invalid argument error (Err:502).
 * If Interval does not match one of the six expected strings, then DATEDIF reports an invalid argument error (Err:502).
 * DATEDIF ignores any time components of Start date or End date.

Examples:
In the following examples, it is assumed that Philippe was born on 1974-04-17 (date-time serial number 27136) and that today's date is 2012-06-13 (date-time serial number 41073).

Related LibreOffice functions:
DAYS

DAYS360

ODF standard:
Section 6.10.3, part 2

Equivalent Excel functions:
DATEDIF