Oracle® OLAP DML Reference 10g Release 1 (10.1) Part Number B10339-02 |
|
|
View PDF |
The MONTHS_BETWEEN function calculates the number of months between two dates. When the two dates have the same day component or are both the last day of the month, then the return value is a whole number. Otherwise, the return value includes a fraction that considers the difference in the days based on a 31-day month. The return value is positive when the first date is later than the second date, and negative when the first date is earlier than the second date.
Return Value
NUMBER
Syntax
MONTHS_BETWEEN(datetime_expression1, datetime_expression2)
Arguments
One expression that has the DATETIME data type, or a text expression that specifies a date.
A second expression that has the DATETIME data type, or a text expression that specifies a date.
Examples