开发者

how can i get the date in "Month Year" format?

开发者 https://www.devze.com 2023-03-27 00:20 出处:网络
I\'m currently using this piece of code to get month and year. CONVERT(varchar, DATEPART(year, StartDate)) + \'-\' +RIGHT(\'0\' + CONVERT(varchar, DATEPART(month, 开发者_高级运维StartDate)), 2) As Mo

I'm currently using this piece of code to get month and year.

CONVERT(varchar, DATEPART(year, StartDate)) + '-' +  RIGHT('0' + CONVERT(varchar, DATEPART(month, 开发者_高级运维StartDate)), 2) As Month

but it returns "2011-06"

My Startdate format = 2011-06-15 14:03:00

I would like to get this into "June 2011" - how can I do that?


SELECT DATENAME(month, getdate()) + ' ' + DATENAME(year, getdate()) 
0

精彩评论

暂无评论...
验证码 换一张
取 消