SQL

Assuming the day of the month is irrelevant (i.e. the diff between 2011.1.1 and 2010.12.31 is 1), with date1 > date2 giving a positive value and date2 > date1 a negative value ((date1.Year - date2.Year) * 12) + date1.Month - date2.Month Or, assuming you want an approximate number of 'average months' between the two dates, the following should work for all but very huge date differences. date1.Subtract(date2).Days / (365.25 / 12) Note, if you were to use the latter solution then your unit tests should state the widest date range for which your application is designed to work with and validate the results of the calculation accordingly.

Dim date1, date2 As Date

date1 = "30/5/2105"

date2 = "1/6/2105"

Dim m As Integer

m = DateDiff(DateInterval.Month, date1, date2) + 1