简体   繁体   English

SQL日期格式转换为MMDDYYYY

[英]SQL date format conversion to MMDDYYYY

转换以下语句以显示MMDDYYYY格式(如02022013没有斜线或连字符)的最佳方法是什么?

CONVERT (CHAR(10), A.POKFRM, 112)

You could take a formatting that gives you elements in order but with / or - and then replace the / or - to get your desired result. 您可以采用格式化,按顺序为您提供元素,但使用/-然后替换/-以获得所需的结果。

select REPLACE(CONVERT (CHAR(10), getdate(), 101),'/','')

Result: 结果:

02022015

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM