date-part Specifies the date part in which the interval is to be measured. Choose one of the date objects listed above. For a complete list of date parts, see Date parts.

date-expression-1 The starting date for the interval. This value is subtracted from date-expression-2 to return the number of date-parts between the two arguments.

date-expression-2 The ending date for the interval. Date-expression-1 is subtracted from this value to return the number of date-parts between the two arguments.

This function calculates the number of date parts between two specified dates. The result is a signed integer value equal to (date2 - date1), in date parts.

The DATEDIFF function results are truncated, not rounded, when the result is not an even multiple of the date part.

When you use day as the date part, the DATEDIFF function returns the number of midnights between the two times specified, including the second date but not the first.

When you use month as the date part, the DATEDIFF function returns the number of first-of-the-months between two dates, including the second date but not the first.

When you use week as the date part, the DATEDIFF function returns the number of Sundays between the two dates, including the second date but not the first.

For the smaller time units there are overflow values:

milliseconds 24 days

seconds 68 years

minutes 4083 years

others No overflow limit

The function returns an overflow error if you exceed these limits.