MicroStrategy ONE
MonthsBetween
Returns the difference in months between two dates as an integer value. The difference is calculated by the number of months elapsed and not by the number of month boundaries crossed. If the first date argument is later than the second date argument, the result is a negative number. The result does not display the timestamps, as they are truncated before performing the calculation.
Syntax
MonthsBetween(
Date
/
Time1
,
Date
/
Time2
)
Where:
Date
/
Time1
is the start date.Date
/
Time2
is the end date.
For information on whether your database supports various date and time functions, see MicroStrategy and Database Support for Functions.
Example
Inputs are the dates 2004-07-29
and 2004-02-28
; output is the integer -5
.
Inputs are the dates 2004-07-29
and 2004-09-29
; output is the integer 2
.