The number of months between datetimes.
The number of months between two datetimes
|FromDateTime||A starting datetime in OI internal format. (REQUIRED)|
|ToDateTime||An ending datetime 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 datetimes. The result will be positive if the starting datetime comes before the ending datetime and negative if the ending datetime comes first.
If Fractional is set to 1, which is the default, you will get a decimal number if the day or time of day are not the same for each datetime. 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 datetimes, then you will get a whole month (plus or minus the time of day). 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 datetime'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.