extract date only from given timestamp in oracle sql

前端 未结 7 1570
后悔当初
后悔当初 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:17

    Use the function cast() to convert from timestamp to date

    select to_char(cast(sysdate as date),'DD-MM-YYYY') from dual;
    

    For more info of function cast oracle11g http://docs.oracle.com/cd/B28359_01/server.111/b28286/functions016.htm#SQLRF51256

提交回复
热议问题