Hi! Why does setting the first day of week to Sunday changes week number? This piece of code
public static void main(String[] args) throws Exception { System.out.println(System.getProperty("java.runtime.name") + " " + System.getProperty("java.runtime.version")); Locale fiFI = new Locale("fi", "FI"); Calendar cal = new GregorianCalendar(fiFI); printWeek(cal); cal.setFirstDayOfWeek(Calendar.SUNDAY); printWeek(cal); } private static void printWeek(Calendar cal) { System.out.println(cal.getTime() + " -> week " + cal.get(Calendar.WEEK_OF_YEAR)); }
prints out the following lines:
Java(TM) SE Runtime Environment 1.8.0_31-b13 Mon Mar 23 10:48:06 EET 2015 -> week 13 Mon Mar 23 10:48:06 EET 2015 -> week 12
Best regards,
Harri