Duplicate :
|
FULL PRODUCT VERSION : java version "1.7.0_67" Java(TM) SE Runtime Environment (build 1.7.0_67-b01) Java HotSpot(TM) 64-Bit Server VM (build 24.65-b04, mixed mode) ADDITIONAL OS VERSION INFORMATION : Linux isis-ws-056 3.13.0-35-generic #62-Ubuntu SMP Fri Aug 15 01:58:42 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux A DESCRIPTION OF THE PROBLEM : The time 1971-10-31 01:59:59 UTC when output in timezone Europe/London is output as being in GMT but with an offset of 1 hour. ADDITIONAL REGRESSION INFORMATION: Happens on all versions of java I have. STEPS TO FOLLOW TO REPRODUCE THE PROBLEM : Run supplied source EXPECTED VERSUS ACTUAL BEHAVIOR : EXPECTED - 1971-10-31 01:59:59 UTC (+0000) 1971-10-31 02:59:59 BST (+0100) ACTUAL - 1971-10-31 01:59:59 UTC (+0000) 1971-10-31 02:59:59 GMT (+0100) REPRODUCIBILITY : This bug can be reproduced always. ---------- BEGIN SOURCE ---------- import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.TimeZone; public class Doh { public static void main(String[] args) { SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss z (ZZZZ)"); TimeZone utcTz = TimeZone.getTimeZone("UTC"); Calendar utcCal = Calendar.getInstance(utcTz); utcCal.setTimeInMillis(57722399000L); format.setTimeZone(utcTz); System.out.println(format.format(utcCal.getTime())); TimeZone lonTz = TimeZone.getTimeZone("Europe/London"); format.setTimeZone(lonTz); System.out.println(format.format(utcCal.getTime())); System.out.println(System.getProperty("java.version")); } } ---------- END SOURCE ---------- CUSTOMER SUBMITTED WORKAROUND : No workaround.