13. 10. 3. Use the MONTHS_BETWEEN function |
|
To find the time difference between two dates, use the MONTHS_BETWEEN function. |
The MONTHS_BETWEEN function returns fractional months. |
The general format of the function is:
MONTHS_BETWEEN(date1, date2) |
where the result will be date1 - date2. |
SQL>
SQL> SELECT MONTHS_BETWEEN(TO_DATE('22SEP2006','ddMONyyyy'), TO_DATE('13OCT2001','ddMONyyyy')) "Months difference"
2 FROM dual;
Months difference
-----------------
59.2903226
SQL>
|
|