我想使用SQL查询将'29 / 05/2014'转换为2014年5月29日的形式 [英] i want to convert '29/05/2014' to the form of 29-may-2014 using SQL query
本文介绍了我想使用SQL查询将'29 / 05/2014'转换为2014年5月29日的形式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我用过
convert ( varchar ( 10 ),' 29/05/2014', 106 )
但它不起作用
解决方案
是的,它不会,表达式应该在datetime
要转换的格式。
它会起作用,因为getdate()
是日期时间
。
选择 转换( varchar ( 14 ),Getdate(), 106 )
所以,请转换你的日期
格式化为日期时间
格式化,然后继续。
选择 转换( varchar ( 14 ), convert ( datetime ,' 29/05/2014', 103 ), 106 跨度>)
I'm used
convert(varchar(10),'29/05/2014' ,106)
but it's not working
解决方案
Yeah, it will not , the expression should be indatetime
format to convert.
it will work,becausegetdate()
isDatetime
.
select convert(varchar(14),Getdate() ,106)
So, please convert yourDate
format intoDatetime
Format before you proceed.
select convert(varchar(14),convert(datetime,'29/05/2014',103) ,106)
这篇关于我想使用SQL查询将'29 / 05/2014'转换为2014年5月29日的形式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文