Friday, 21 January 2011

SQL: Format Dates with DATENAME()

DATNAME() is an ANSI compliant, fast date part function built into SQL Server.

It accepts two arguments datepart and date. The datepart parameter specifies which part of the date to return - day, month, year with the function returning an nvarchar.

Syntax
DATENAME ( datepart ,date)

Example
SELECT DATENAME(m, GETDATE())

Result
January

0 comments:

Post a Comment

 

Popular Posts

developer-express Copyright © 2009 Black Nero Blogspot Templatesis Designed by Ipietoon Sponsored by Online Business Journal