Difference between two dates in Years and Months.

  • Thread starter Thread starter Floyd Forbes
  • Start date Start date
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
 
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
 
Back
Top