Calculate and return the difference between two date values, expressed in years.
| SELECT DATEDIFF(year, ‘2017/08/25’, ‘2011/08/25’) AS DateDiff; | 
The DATEDIFF() function computes and returns the difference between two dates as an integer value.
| DATEDIFF(interval, date1, date2) | 
| Parameter | Description | 
| interval | Required: Specify the unit of time to return. Use one of the following values: 
 
 | 
| date1, date2 | Required: Specify the two dates between which to calculate the difference. | 
| Return type: | int | 
| Works in: | SQL Server (beginning from 2008), Azure SQL Database, Azure SQL Data Warehouse, and Parallel Data Warehouse | 
Calculate and return the difference between two date values, expressed in months.
| SELECT DATEDIFF(month, ‘2017/08/25’, ‘2011/08/25’) AS DateDiff; | 
Calculate and return the difference between two date values, expressed in hours.
| SELECT DATEDIFF(hour, ‘2017/08/25 07:00’, ‘2017/08/25 12:45’) AS DateDiff; |