I am trying to get the number of months from, say, August 2016 to today. I can’t figure out how to use monthmath( to get an answer. I tried setting variables for the pastDate and currentDate, but have not figured how to get the number of intervening months.

The monthmath( function is for the opposite calculation – what date is nth months from today?

There is no function that performs the calculation you are looking for. You can get an approximation by subtracting the number of days and dividing by 30. But if you wanted to get a more exact number you would have to write a procedure with a loop. Power Team used to have a calculation that would calculate years, months and days that way, it was quite involved.

OK. thanks for the quick response!

Subtracting the past date from the current date will give you the number of days. After that it’s mainly a question of how you define a month. Dividing the days by 30 might be one solution. If you are counting calendar months, do you count the interval from Dec 31 to Jan 1 as one month? If so, you could multiply the years by 12, add the months and subtract i.e.

`CurrentYear*12 + CurrentMonth - (PastYear*12 + PastMonth)`

Thanks, Dave, your suggestion is working fine.