将日期时间列格式化为 DD MONTH YYYY

2021-09-10 00:00:00 tsql sql-server

这可能是一个非常简单的问题,但我未能以 "16 October 2013" 格式格式化我的 datetime 列,请提供任何帮助/建议!!!!

Hi it maybe a very simple question but I am failing to format my datetime column in the format of "16 October 2013" any help/suggestions please !!!!

推荐答案

SELECT CAST(DAY(GETDATE()) AS VARCHAR(2)) + ' ' + DATENAME(MM, GETDATE()) + ' ' + CAST(YEAR(GETDATE()) AS VARCHAR(4)) AS [DD Month YYYY]

相关文章