|
datename()
The
Date & Time Function
datename()
returns a fragment, i.e. the
date part
of a given date value.
Syntax of the Datatype Conversion Function datename()
datename( date_part, date expression )
The parameter of the Datatype Conversion Function datename()
date_part
The parameter "date_part" is a placeholder for the abbreviation of a part of a date value. (See also:
date parts.)
date expression
The parameter "date expression" is a placeholder for a date which can be returned as
datetime,
smalldatetime,
date (starting with
ASE®
version 15.0),
time (starting with ASE® Version 15.0)
datatype
or as
character string
in date format.
Example for the Datatype Conversion Function datename()
declare @a datetime
select @a = "Apr 12, 2006"
select datename(mm, @a)
go
-----
April
Returns the written out name of the month for the given date.
See also:
ASE T-SQL - Aggregate Functions, Date and Time Functions, dateadd(), datediff(), datepart(), date_part, day(), getdate(), month(), style numbers, year().
|