当前位置: 代码迷 >> DB2 >> 怎么将日期格式转换为timestamp
  详细解决方案

怎么将日期格式转换为timestamp

热度:6265   发布时间:2013-02-26 00:00:00.0
如何将日期格式转换为timestamp
在DB2数据库中存储时间的时间格式是timestamp,我的SQL语句为:select   *   from   dcontact   where   proctime   between   startime   and   endtime;startime和endtime是20070123格式的,怎转化成timestamp格式的,请高手赐教!!!

------解决方案--------------------------------------------------------
最后6位296000是微秒
------解决方案--------------------------------------------------------
db2 => select *from dcontact where date(proctime) between date(substr(startime ,1,4
)|| '- '||substr(startime ,5,2)|| '- '||substr(startime ,7,2)) and date(substr(endtime,1,4
)|| '- '||substr(endtime,5,2)|| '- '||substr(endtime,7,2))
  相关解决方案