function returns the difference between two dates as a number, defaulting to the number of days between the dates. This function acts similarly to Microsoft Excel's datedif
function. The numeric expressions start_date
must be in YYYYMMDD (year/month/day) format. If no year is present then the current or next year is assumed in order to satisfy the condition that the start date is earlier than the end date. If years are present, it is possible for the start date to be later than the end date, in which case the function returns a negative difference. An optional string expression, diff_type
, indicates the type of date difference requested, and can be one of the following values:
The function returns the requested difference in dates, defaulting to the number of days between the dates. If the dates cannot be processed, the function returns default
. The function returns values equal to Excel's function for most parameters, but due to processing differences involving leap years, sometimes CSPro's function will return a value different from Excel's.