Sun's API document says about java.util.Calendar.WEEK_OF_MONTH, "The first week of the month, as defined by getFirstDayOfWeek() and getMinimalDaysInFirstWeek(), has value 1."
But GNU Classpath's java.util.GregorianCalendar returns 0 for the first week of the month except for those special months whose first day is Sunday (e.g. Jun 2003). Here is my patch: --- java/util/GregorianCalendar.java.orig Sun Mar 24 01:10:15 2002 +++ java/util/GregorianCalendar.java Mon Jul 28 11:53:16 2003 @@ -599,7 +599,7 @@ // which day of the week are we (0..6), relative to getFirstDayOfWeek int relativeWeekday = (7 + fields[DAY_OF_WEEK] - getFirstDayOfWeek()) % 7; - fields[WEEK_OF_MONTH] = (fields[DAY_OF_MONTH] - relativeWeekday + 6) / 7; + fields[WEEK_OF_MONTH] = (fields[DAY_OF_MONTH] - relativeWeekday + 12) / 7; int weekOfYear = (fields[DAY_OF_YEAR] - relativeWeekday + 6) / 7; By the way, while GNU Classpath's Calendar returns 53 or 54 as the last week of the year, Sun's Java 1.4.2 returns 1. I think this may be a bug of Sun's. _______________________________________________ Classpath mailing list [EMAIL PROTECTED] http://mail.gnu.org/mailman/listinfo/classpath