oracle:
to_char(t_date( '20070928112400 ', 'yyyymmddhh24miss '), 'yyyy/mm/dd hh24:mi ')
DB中日期栏是14位的日期字符串(包含年月日时分秒)
用sqlserver如何描述呢?
------解决方案--------------------
declare @s as varchar(14)
set @s = '20070928112400 '
select cast(left(@s,8) + ' ' + substring(@s,9,2) + ': ' + substring(@s,11,2) + ': ' + substring(@s,13,2) as datetime) 日期
/*
日期
------------------------------------------------------
2007-09-28 11:24:00.000
(所影响的行数为 1 行)
*/
------解决方案--------------------
---这个短点
declare @s as varchar(50)
set @s = '20070928112400 '
select stuff(stuff(stuff(@s,13,0, ': '),11,0, ': '),9,0, ' ')
--------------20070928 11:24:00