If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register or Login
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Re: Calculating the months betweeen two dates

The reason it gives 13 rather than 12 is that the time period specified is more than 12 months. It is 367 days. You might get better accuracy by taking the number of days between the dates divided by the number of days in a year (roughly 365.25), then get the Integer of that result multiplied by 12. This may not be perfectly accurate however. Especially over an extended period of time.

Perhaps a better thing to do is to test each date to see if it covers an entire month. Meaning that the first date would have to be the first day of a month, and the last date would have to be the last day of a month. If not, subtract from the result given by DateDiff.

Please remember to rate the posts and threads that you find useful.How can something be both new and improved at the same time?