日期:2014-05-20  浏览次数:22162 次

sql日期转化
Friday, June 18, 2010 4:02:46 PM 这个日期在sql中怎么转化为 2010-06-18 16:02:46

------解决方案--------------------
Convert(DateTime,你的字段)
or 
cast(你的字段 as DateTime)
------解决方案--------------------
探讨

Convert(DateTime,你的字段)
or
cast(你的字段 as DateTime)

------解决方案--------------------
declare @str as varchar(20)
set @str = '1 Jan 2010'
select cast(@str as datetime)
c# dateTime.ParseExact
------解决方案--------------------
两个方法:
第一种:
select Convert(DateTime,yourField) as yourFieldName from yourTable
第二种:
select cast(yourFiel as DateTime) as yourFiedName from yourTable

OK