I want to calculate the monday of a specific week number of a year. This is how I do it:
final GregorianCalendar calendar = new GregorianCalendar(Locale.GERMANY); calendar.clear(); calendar.set(Calendar.YEAR, 2012); // set to 2012 calendar.set(Calendar.WEEK_OF_YEAR, 20); // set to week number 20 calendar.setTimeZone(TimeZone.getTimeZone("Europe/Berlin")); // set time zone SimpleDateFormat sdf = new SimpleDateFormat("dd.MM.yy"); // german format System.out.println(sdf.format(calendar.getTime())); // return date This has to return the 14th of May 2012 (14.05.12 in german format), but it returns the 16th of May 2012, but this is wrong.
So for 2012 its +2, 2011 is correct and 2010 is -1.
Why does the GregorianCalendar calculate the wrong date?
Thanks in advance and greets from germany.