Wednesday, March 28, 2012

how to show the month name?

I am using

selectmonth(date_field)

to display the month but it's showing the month number and I want to show as names, e.g. Jan, Feb, Mar. etc..

|||

Jassim:

Lookup the DATENAME function in books online; it should be something like:

select datename (mm, date_field)

Or if you want to only show the first three letters of the month:

select left(datename (mm, date_field), 3)

|||Select Convert(Varchar(3),Datename(mm,getdate()))

No comments:

Post a Comment