Contents Index DATEFORMAT function [Date and time] DATEPART function [Date and time]

ASA SQL Reference
  SQL Functions
    Alphabetical list of functions

DATENAME function [Date and time]


Function 

Returns the name of the specified part (such as the month "June") of a datetime value, as a character string.

Syntax 

DATENAME ( date-partdate-expression )

Parameters 

date-part    The date-part to be named.

For a complete listing of allowed date-parts, see Date parts.

date-expression    The date for which the date-part name is to be returned. The date must contain the requested date-part.

Usage 

DATENAME returns a string, even if the result is numeric, such as 23 for the day.

Standards and compatibility 
Example 

The following statement returns the value May.

SELECT datename( month , '1987/05/02' )

Contents Index DATEFORMAT function [Date and time] DATEPART function [Date and time]