开发者

Format a Date into Mai 2010 in T-SQL

how do I format a date (smalldatetime) in Mai 2010 (i.e. 06.05.2010 => Mai 2010 or 06.10.2009 => October开发者_如何学Python 2009)

thx a lot... greetings


SELECT SUBSTRING(CONVERT(VARCHAR(20), GETDATE(), 107), 0, 4) + SUBSTRING(CONVERT(VARCHAR(20), GETDATE(), 107), 8, 5)

Changing GETDATE() with your column.


You can use the CONVERT function to convert it to a string, the function can take an optional 3d parameter called style that takes an integer determining the formatting.

more info here

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜