select to_date('2004/12/02 上午 10:47:08','yyyy/mm/dd am hh24:mi:ss') from dual;

解决方案 »

  1.   

    select to_date('2004/12/02 上午 10:47:08','yyyy/mm/dd am hh:mi:ss') from dual;上句24不要
      

  2.   

    select to_date('2004/12/02 上午 10:47:08','yyyy/mm/dd am hh:mi:ss') from dual;=========已测试通过 为OK
      

  3.   

    可问题是如果,users表中有个varchar型字段(LastVisitDate) ,里面已经有不同的日期格式如'2004/10/10 10:23:22' ,'2004/10/10 上午 10:23:22' '5月/23/2004',那怎么处理了,运行 select to_date(LastVisitDate,'yyyy/mm/dd AM hh:mi:ss') from users 会提示出错,请指教谢谢
      

  4.   

    to_date(replace(lastvisitdate,'上午',''),'yyyy/mm/dd hh:mi:ss')
      

  5.   

    to_date(replace(replace(lastvisitdate,'上午',''),'下午',''),'yyyy/mm/dd hh:mi:ss')
      

  6.   

    總之就是用to_char(),to_date(),replace()來做啦,自己組合吧.