oracle 使用 ROUND 和 EXTRACT 操作日期
SQL> select to_char(sysdate,'yyyy/mm/dd hh24:mi:ss') "date", 2 extract(YEAR FROM SYSDATE) "year", 3 extract(MONTH FROM SYSDATE) "month", 4 extract(DAY FROM SYSDATE) "day", 5 extract(HOUR FROM SYSTIMESTAMP) "hour", 6 extract(MINUTE FROM SYSTIMESTAMP) "minute", 7 extract(SECOND FROM SYSTIMESTAMP) "second" 8 from dual;--HOUR 匹配的结果没有加上时区,因此在中国运行的结果小8小时date year month day hour minute second------------------- ---------- ------- ------- ------- ------- ----------2012/04/03 18:53:42 2012 4 3 10 53 42.79?
?