-
Bug
-
Resolution: Fixed
-
P4
-
1.3.1
-
rc
-
x86
-
windows_2000
-
Verified
Name: nt126004 Date: 11/14/2001
java version "1.3.1_01"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.1_01)
Java HotSpot(TM) Client VM (build 1.3.1_01, mixed mode)
In Ukraine first day of week is Monday but not Sunday
By defaults in the calendar object obtained with locale ua_UA getFirstDayOfWeek
() function return SUNDAY as a first week day.
The code below illustrates this problem.
====================================
import java.util.Locale;
import java.util.Calendar;
public class Test {
public static void main(String[] args) {
Locale locale = new Locale("ua", "UA");
System.out.println("Locale: '" + locale + "'");
System.out.println("SUNDAY: " + String.valueOf
(Calendar.SUNDAY));
System.out.println("MONDAY: " + String.valueOf
(Calendar.MONDAY));
Calendar calend = Calendar.getInstance(locale);
System.out.println("Default first week day: " + String.valueOf
(calend.getFirstDayOfWeek()));
}
}
The console input produced:
Locale: 'ua_UA'
SUNDAY: 1
MONDAY: 2
Default first week day: 1
(Review ID: 135526)
======================================================================
Name: nt126004 Date: 01/31/2002
FULL PRODUCT VERSION :
java version "1.3.1"
FULL OPERATING SYSTEM VERSION :
Windows 2000 EN, SP2
Windows 98 SE
A DESCRIPTION OF THE PROBLEM :
I tried to use a GregorianCalendar with my Locale. There is
a problem: the first day of a week in Hungary is MONDAY,
but in the SUN files that is specified SUNDAY.
This is a not-a-big problem for US people, but for me,
that's a bug.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1, Make a new Calendar, with locale (hu,HU)
2, Test the first day of week
3, In Hungary, the first day of a week is Monday, not Sunday
EXPECTED VERSUS ACTUAL BEHAVIOR :
The firstday should be Calendar.MONDAY, not
Calendar.SUNDAY
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.util.*;
...
Calendar cal = new GregorianCalendar(TimeZone.getTimeZone("ECT"), new Local
("hu","HU"));
int firstday = cal.getFirstDayOfWeek();
if (firstday == Calendar.MONDAY)
System.out.println("The first day is MONDAY");
if (firstday == Calendar.SUNDAY)
System.out.println("The first day is SUNDAY");
...
---------- END SOURCE ----------
CUSTOMER WORKAROUND :
Well, you cannot use hungarian locale for a Calendar,
you should use:
de, CH.
It works, but it isn't the ultimate soultion
(Review ID: 138321)
======================================================================
- relates to
-
JDK-4302966 In Czech Republic first day of week is Monday not Sunday
-
- Resolved
-
-
JDK-4749528 In Catalonia, first day of week is monday, not sunday
-
- Closed
-
-
JDK-7060794 Regression: Calendar.getFirstDayOfWeek() returns wrong value in Ukraine locale
-
- Closed
-