datename

Returns "datepart" from "date_expression", which can be a datetime, smalldatetime, date, or time value as an ASCII string. 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

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

Example

datename ( {mm} , 2000-01-01 )

Result

January