oracle 日期
select abs(trunc(sysdate,'MM')-trunc(TO_DATE('2010-10-11','YYYY-MM-DD'),'MM')) from dual;
相当于sql datediff(m,...)
SELECT EXTRACT(YEAR FROM SYSDATE) FROM DUAL; return Current Year
SELECT EXTRACT(MONTH FROM SYSDATE) FROM DUAL; return Current Month
SELECT EXTRACT(DAY FROM SYSDATE) FROM DUAL; return Current Day
SELECT EXTRACT(HOUR FROM SYSDATE) FROM DUAL;Error
Correct:SELECT EXTRACT(HOUR FROM TIMESTAMP '2005-10-10 10:10:10') FROM DUAL;
SELECT EXTRACT(MINUTE FROM SYSDATE) FROM DUAL;Error
Correct:SELECT EXTRACT(MINUTE FROM TIMESTAMP '2005-10-10 10:10:10') FROM DUAL