select sysdate from dual; select to_date('2002-01-01','yyyy-mm-dd') from dual;
SQL> select trunc(sysdate,'dd') from dual;TRUNC(SYSDATE,'DD') ------------------- 2002-12-02 00:00:00
日期:example select * from tablename where 日期>=to_date('2002-01-01','yyyy-mm-dd ')带时间: select * from tablename where 日期>=to_date('2002-01-01 01:01:01','YY-MM-DD HH24:MI:SS')
select to_char(sysdate,'yyyy-mm-dd') from dual; select to_date(sysdate,'yyyy-mm-dd') from dual;
select to_date('2002-01-01','yyyy-mm-dd') from dual;
-------------------
2002-12-02 00:00:00
select * from tablename where 日期>=to_date('2002-01-01','yyyy-mm-dd ')带时间:
select * from tablename where 日期>=to_date('2002-01-01 01:01:01','YY-MM-DD HH24:MI:SS')
select to_date(sysdate,'yyyy-mm-dd') from dual;
楼上说的够详细了