日期:2014-05-17 浏览次数:20660 次
DECLARE @deDate VARCHAR(30) ='20130520141555'
SELECT CONVERT(DATETIME, CONVERT(VARCHAR, CONVERT(DATE, LEFT(@dedate, 8)))
+ ' ' + SUBSTRING(@dedate, 9, 2) + ':' + SUBSTRING(@dedate, 11, 2)
+ ':' + RIGHT(@dedate, 2))
--2013-05-20 14:15:55.000
declare @dedate varchar(20)
set @deDate ='20130520141555'
select convert(datetime,substring(left(@deDate,8)+' ' + substring(@deDate,9,2)+':' + substring(@deDate,11,2)+':' + substring(@deDate,13,2),1,20))