Returns the name of the specified part (such as the month “June”) of a date/time value, as a character string.
Parameter |
Description |
---|---|
date-part |
The date part to be named. |
date-expression |
The date for which the date part name is to be returned. The date must contain the requested date-part. |
VARCHAR
The following statement returns the value May:
SELECT DATENAME( MONTH , '1987/05/02' ) FROM iq_dummy
SELECT DATENAME(MICROSECOND, '2009-11-10 14:57:52.722001') FROM iq_dummy
SELECT DATENAME(MICROSECOND, '2000/07/07 07:07:07.777777') FROM iq_dummy
SELECT DATENAME(MCS, '2009-11-03 11:10:42.033189') FROM iq_dummy