I want to find difference between 2 dates in number of months using GregorianCalend ar utility. I want it to work fine considering the year having 28, 29, 30 or 31 days in month. It should give me exact difference in all possible cases. Please help soon. Thanks in advance.
Finding difference of 2 dates in months using GregorianCalendar
Collapse
X
-
Tags: None
-
I'd enter the dates as a Date type and simply subtract the two. This will give you the difference in days, hours, minutes, seconds, milliseconds. It doesn't however give you the difference in months. To do that I might do something likeOriginally posted by Shamim1983I want to find difference between 2 dates in number of months using GregorianCalend ar utility. I want it to work fine considering the year having 28, 29, 30 or 31 days in month. It should give me exact difference in all possible cases. Please help soon. Thanks in advance.
date2.Year*12 + date2.Month - date1.Year*12 - date1.Month
Wagz
Comment