datepart

Returns part of "date_expression" (for example, the month) as an integer. "date_expression" can be a datetime, smalldatetime, date, or time value. Note that "datepart" must be a keyword representing a datepart or its abbreviation recognized by Microsoft® SQL Server and must be enclosed in curly brackets.

Syntax

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

Example

datepart ( {wk} , 2000-01-01 )

Result

1 (first week of the year)