Difference between two dates in Years and Months.

F

Floyd Forbes

I'd like the difference between two dates to be displayed in years and
months.
How do I format the DateDiff function so that I can achieve this?

Appreciate any help!

Floyd
 
K

Ken Snell

Use DateDiff to return the number of months, then change that to years and
months (note that partial months may be incorrectly calculated as full
months using DateDiff):

NumberOfYears = DateDiff("m", StartDate, EndDate) \ 12
NumberOfMonths = DateDiff("m", StartDate, EndDate) - NumberOfYears * 12
 
Top