DATENAME Function

Returns a human-readable text string representing the specified part of a date. Month and day names (like "January" and "Monday") are returned according to the local computer's culture settings. Other date parts are returned as numbers that have been converted to strings.

Syntax

DATENAME(date-part, date)

Parameters

Return Value

A string containing the part of date that is specified by date-part.

Example

-- The following examples assume a US English computer.
-- In other locales, DATENAME() will return locale-specific names.
PRINT DATENAME('month', '2016-07-23'); -- "July"
PRINT DATENAME('weekday', '2016-07-23'); -- "Saturday"
PRINT DATENAME('dd', '2016-07-23'); -- "23"