Skip Headers
Oracle® OLAP Expression Syntax Reference
Release 11.2

Part Number E23381-01
Go to Documentation Home
Home
Go to Book List
Book List
Go to Table of Contents
Contents
Go to Master Index
Master Index
Go to Feedback page
Contact Us

Go to previous page
Previous
Go to next page
Next
PDF · Mobi · ePub

MONTHS_BETWEEN

MONTHS_BETWEEN 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.

Return Value

NUMBER

Syntax

MONTHS_BETWEEN(date1, date2)

Arguments

date1 and date2 are datetime expressions. If date1 is later than date2, then the result is positive. If date1 is earlier than date2, then the result is negative.

Example

MONTHS_BETWEEN('15-APR-06', '01-JAN-06') returns the value 3.4516129.