sqlserver字符串转为datetime的方法

源数据为'yyyymmddhh24miss',则SQL为sql

CONVERT(datetime, SUBSTRING(opentime,1,4) +'/'+SUBSTRING(opentime,5,2) +'/'+SUBSTRING(opentime,7,2)+' '    +SUBSTRING(opentime,9,2)+':'+SUBSTRING(opentime,11,2)+':'+SUBSTRING(opentime,13,2), 120)

 至于其余的形式的,能够参考这个作修改。blog

相关文章
相关标签/搜索