Calendar.firstDayOfWeek toruble with locales
Hallo,
I have troubles with calendar class. Seems like locale is not affecting first day of week property.
For this piece of code
Calendar calendar;
calendar = Calendar.getInstance(new Locale("sk_SK"));// 1 is monday, ok
System.out.println(calendar.getFirstDayOfWeek());
calendar = Calendar.getInstance(new Locale("en_US"));// 1?
System.out.println(calendar.getFirstDayOfWeek());
calendar = Calendar.getInstance(new Locale("ar_BH"));// 1? should be 7?
System.out.println(calendar.getFirstDayOfWeek());
calendar = Calendar.getInstance(new Locale("ar"));
System.out.println(calendar.getFirstDayOfWeek());// is 7 ok?
I get output 1, 1?, 1?, 7
I've already lost time solving this 'problem'. Can you push me into right direction please? My default locale first day of week is1.
Thank you for advice
Adam
[1262 byte] By [
a3cchana] at [2007-11-26 13:36:08]

The second is correct, the default for us en is Monday for first day of week.
Your Locale constructors are wrong, separate the language from the country as 2 separate strings.
calendar = Calendar.getInstance(new Locale("ar","BH"));// Prints 7
The ones that are right I think are my coincidence, when the locale isn't recognized, it uses the local systems default.
~Tim
Oh! Thank you. That was one stupid mistake :-) But anyway, even after modification results are 'unexpected':
Calendar calendar;
System.out.println("Calendar.SUNDAY = "+Calendar.SUNDAY);
System.out.println("Calendar.MONDAY = "+Calendar.MONDAY);
calendar = Calendar.getInstance(new Locale("sk")); // SUNDAY!?!!
System.out.println(calendar.getFirstDayOfWeek());
calendar = Calendar.getInstance(new Locale("en", "US")); // SUNDAY ok
System.out.println(calendar.getFirstDayOfWeek());
calendar = Calendar.getInstance(new Locale("en", "GB")); // MONDAY ok
System.out.println(calendar.getFirstDayOfWeek());
I am absolutely sure that first day of week in Slovakia is Monday (I live here^_^). Locale "sk" and even "sk_SK" is among values of Calendar's avaiableLocale property. :-(
Any idea pleas?
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6497154 says:
getFirstDayOfWeek() not works correctly for Slovak locale
...
DESCRIPTION OF THE PROBLEM :
Calendar.getInstance().getFirstDayOfWeek() returns SUNDAY for SK locale (Slovakia)
...
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
it should return MONDAY
ACTUAL -
returns SUNDAY
...