datepart

Returns "datepart" of "date_expression" as an integer. "Date_expression" can be a datetime, smalldatetime, date, or time value. Note that the datepart argument must be enclosed in curly brackets.

Syntax

datepart ( ' { ' datepart ' } ' , date_expression )

Example

datepart ( {mm} , 1999-05-01 )

Result

5