How do I use sql to get the whole month name in sql server?
I did't find a way using DATEPART(mm, mydate)
or CONVERT(VARCHAR(12), CreatedFor, 107)
.
Basically I need in the format: April 1 2009.
SELECT DATENAME(MONTH, GETDATE())
+ RIGHT(CONVERT(VARCHAR(12), GETDATE(), 107), 9) AS [Month DD, YYYY]
OR Date without Comma Between date and year, you can use the following
SELECT DATENAME(MONTH, GETDATE()) + ' ' + CAST(DAY(GETDATE()) AS VARCHAR(2))
+ ' ' + CAST(YEAR(GETDATE()) AS VARCHAR(4)) AS [Month DD YYYY]