I have a problem getting the week of the year. JDK version 1.6.0.22 is installed on my machine, 1.6.0.21 on another machine. And both machines return different results:
(1.6.0.22) Week: 1
(1.6.0.21) Week: 52
For this code:
try {
Calendar current = new GregorianCalendar();
DateFormat df = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
Date d = df.parse("2010-12-28 19:04:38 GMT");
current.setTime(d);
int currentWeek = current.get(Calendar.WEEK_OF_YEAR);
System.out.println("week is: "currentWeek);
} catch (ParseException e) {
e.printStackTrace();
}
Why does JDK 1.6.0.22 give the wrong result?
Õzbek source
share