datediff

Returns the number of units indicated by "datepart" (day, month, year) between "date_expression1" and "date_expression2". Note that "datepart" must be enclosed in curly brackets.

Syntax

datediff ( ' { ' datepart ' } ' , date_expression1 ,
 date_expression2 )

Example

datediff ( {yy} , 1984-01-01 , 1997-01-01 )

Result

13