extract date only from given timestamp in oracle sql

前端 未结 7 1556
后悔当初
后悔当初 2021-02-13 05:34

The following query:

select cdate from rprt where cdate <= TO_CHAR(sysdate, \'YYYY/MM/DD-HH24-MI-SS-SSSSS\') and ryg=\'R\' and cnum=\'C002\';
<
7条回答
  •  一向
    一向 (楼主)
    2021-02-13 06:12

    Convert Timestamp to Date as mentioned below, it will work for sure -

    select TO_DATE(TO_CHAR(TO_TIMESTAMP ('2015-04-15 18:00:22.000', 'YYYY-MM-DD HH24:MI:SS.FF'),'MM/DD/YYYY HH24:MI:SS'),'MM/DD/YYYY HH24:MI:SS') dt from dual
    

提交回复
热议问题