The number of months between dates.
The number of months between two dates
|FromDate||A starting date in OI internal format. (REQUIRED)|
|ToDate||An ending date in OI internal format. (REQUIRED)|
|Fractional||Determines if the span should be in whole months or fractional months. (OPTIONAL)|
The "MonthSpan" service calculates the number of months between two dates. The result will be positive if the starting date comes before the ending date and negative if the ending date comes first.
If Fractional is set to 1, which is the default, you will get a decimal number if the day of the months are not the same for each date. If you want whole months only, set Fractional to 0.
Months are an abstract concept, so calculating a fraction of a month gets interesting. If the day of the month is the same between dates, then you will get a whole number result. For example, calculating the span between February 28 and March 28 will return 1.0 as will the span between March 28 and April 28, even though there are only 28 days between the first pair and 31 days between the second. If the day of the months are different, then the fraction is based on the number of days in the earlier date's month. For example, March 30 to April 27 will return 0.903225806451612, for there are 31 days in march and 28 days between March 30 and April 27: thus, 28 / 31 is 0.903225806451612. April 30 to May 27 returns 0.933333333333333; a slightly different value because April only has 30 days. Thus, fractional months are useful for giving an approximate fractional span but should be considered as abstract as months themselves.