[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug #4741] java.util.GregorianCalendar returns 0 for the first week of
From: |
nobody |
Subject: |
[bug #4741] java.util.GregorianCalendar returns 0 for the first week of the month |
Date: |
Thu, 14 Aug 2003 00:49:59 -0400 |
User-agent: |
w3m/0.4 |
=================== BUG #4741: FULL BUG SNAPSHOT ===================
http://savannah.gnu.org/bugs/?func=detailbug&bug_id=4741&group_id=85
Submitted by: None Project: classpath
Submitted on: Thu 08/14/2003 at 00:49
Severity: 5 - Major Resolution: None
Assigned to: None Status: Open
Platform Version: None
Summary: java.util.GregorianCalendar returns 0 for the first week of the month
Original Submission: 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.
No Followups Have Been Posted
CC list is empty
No files currently attached
For detailed info, follow this link:
http://savannah.gnu.org/bugs/?func=detailbug&bug_id=4741&group_id=85
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [bug #4741] java.util.GregorianCalendar returns 0 for the first week of the month,
nobody <=