Get the correct TimeZone on DateFormatTag(s): Date and Time
There is a bug in the DateFormat/SimpleDateFormat classes. We must set the TimeZone manually.
System.out.println("Good TimeZone from Calendar : " + Calendar.getInstance().getTimeZone().getID()); DateFormat df = DateFormat.getDateInstance(); System.out.println("Bad TimeZone from DateFormat : " + df.getTimeZone().getID()); // fix the TimeZone df.setCalendar(Calendar.getInstance()); System.out.println("Good TimeZone from DateFormat : " + df.getTimeZone.getID());