Calculating the number of months between 2 dates

  • Thread starter Thread starter Steve Welman
  • Start date Start date
S

Steve Welman

Hi

I have 2 dates in variables called newincepdate and incepdate, what I would
like to know is the number of months between these dates.

As in, if newincepdate is 01/03/2006 and incepdate is 01/01/2006, I need it
to return 2, how do I do this

My date format is set dd/mm/yyyy

Thanks in advance

Steve
 
Steve,

intMonths = DateDiff("m", incepdate, newincepdate ) + (Format(incepdate,
"ddhhnnss") > Format(newincepdate, "ddhhnnss")

(The above should all be on one line)

Regards,
Graham R Seach
Microsoft Access MVP
Canberra, Australia
 
Check out the DateDiff() function. It will give you the difference
between two dates, in various units including hours, days, weeks, & so
on.

HTH,
TC [MVP Access]
 
Back
Top