[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug classpath/22690] java.util.GregorianCalendar returns 0 for the firs
From: |
gcc-bugzilla at gcc dot gnu dot org |
Subject: |
[Bug classpath/22690] java.util.GregorianCalendar returns 0 for the first week of the month |
Date: |
16 Oct 2005 01:26:34 -0000 |
Date: Mon, 28 Jul 2003 14:43:50 +0900
Message-Id: <address@hidden>
From: Ito Kazumitsu <address@hidden>
To: address@hidden
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.
------- Comment #1 from from-classpath at savannah dot gnu dot org 2004-01-01
16:47 -------
Patch applied to classpath.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22690
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Bug classpath/22690] java.util.GregorianCalendar returns 0 for the first week of the month,
gcc-bugzilla at gcc dot gnu dot org <=