Hi
can any one please help me how to calculate the number of months between two dates.
Thanks
Number of months between two dates
Moderators: chulett, rschirm, roy
-
- Participant
- Posts: 8
- Joined: Thu Jun 17, 2010 1:12 am
Number of months between two dates
reddy,amarnath
One method that worked for a client several years ago was:
where Date1 is the later of the two dates (Year1, Month1, Day1). That particular client didn't care about the number of days in the month for the calculation. How you extract Year, Month and Day will depend on the format of your dates.
Regards,
Code: Select all
(Year1 - Year2) * 12 + (Month1 - Month2) + (if Day1 >= Day2 then 1 else 0)
Regards,
- james wiles
All generalizations are false, including this one - Mark Twain.
All generalizations are false, including this one - Mark Twain.