Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Date Format

Author  Topic 

SQLNewbieHere
Starting Member

12 Posts

Posted - 2008-05-29 : 07:13:47
I want to change 4/12/2008 to simply April. Is that possible?

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-05-29 : 07:16:54
Yes.

And if you haven't found the answer in Books Online yet,
try CONVERT function or DATENAME function.

SELECT DATENAME(MONTH, MyDateTimeColumnOrDateTimeVariableHere)



E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page

SQLNewbieHere
Starting Member

12 Posts

Posted - 2008-05-29 : 07:59:13
Thanks. How can I can combine it with SELECT DATEADD(MONTH, DATEDIFF(MONTH, '19000101', GETDATE()), '19000101') AS Month4? So I won't be creating another query view.
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-05-29 : 08:10:01
SELECT DATENAME(MONTH, DATEADD(MONTH, DATEDIFF(MONTH, '19000101', GETDATE()), '19000101')) AS Month4



E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page
   

- Advertisement -