I want to find difference between 2 dates in number of months using GregorianCalendar 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.
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 like
date2.Year*12 + date2.Month - date1.Year*12 - date1.Month
Wagz