SQL DATEDIFF Function

Example

Return the difference between two date values, in years:

SELECT DATEDIFF(year, '2017/08/25', '2011/08/25') AS DateDiff;

Definition and Usage

The DATEDIFF() function returns the difference between two dates, as an integer.

Syntax

DATEDIFF(interval, date1, date2)

Continue reading SQL DATEDIFF Function