Maybe this....

public static int monthsBetween(Date minuend, Date subtrahend)
 {
 Calendar cal = Calendar.getInstance();
 // default will be Gregorian in US Locales
 cal.setTime(minuend);
 int minuendMonth =  cal.get(Calendar.MONTH);
 int minuendYear = cal.get(Calendar.YEAR);
 cal.setTime(subtrahend);
 int subtrahendMonth =  cal.get(Calendar.MONTH);
 int subtrahendYear = cal.get(Calendar.YEAR);

 // the following will work okay for Gregorian but will not
 // work correctly in a Calendar where the number of months
 // in a year is not constant
 return ((minuendYear - subtrahendYear) * cal.getMaximum
(Calendar.MONTH)) +
 (minuendMonth - subtrahendMonth);
}

I found this on 
http://www.coderanch.com/t/381676/Java-General-intermediate/java/get-number-months-between-two

bye

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"GWT-Ext Developer Forum" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/gwt-ext?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to