Duplicate :
|
|
Relates :
|
|
Relates :
|
|
Relates :
|
FULL PRODUCT VERSION : 6 ADDITIONAL OS VERSION INFORMATION : Linux 2.6.9-55.0.0.0.2.ELsmp #1 SMP Wed May 2 14:59:56 PDT 2007 i686 i686 i386 GNU/Linux IBM AIX (64-bit) A DESCRIPTION OF THE PROBLEM : When TZ environment variable is set to MEZ-1MESZ,M3.5.0,M10.5.0 timezone, SimpleDateFormat.format(Date) is an hour late. STEPS TO FOLLOW TO REPRODUCE THE PROBLEM : $ setenv TZ MEZ-1MESZ,M3.5.0,M10.5.0 $ java DateUtils $ date EXPECTED VERSUS ACTUAL BEHAVIOR : EXPECTED - The output from "java DateUtils" is consistent with the output from the Unix command "date". ACTUAL - The output from "java DateUtils" is one hour late, compared to the Unix command "date". For example, $ setenv TZ MEZ-1MESZ,M3.5.0,M10.5.0 $ date Mon Sep 29 22:47:29 MESZ 2008 $ java DateUtils Now : 2008-09-29 21:47:35 REPRODUCIBILITY : This bug can be reproduced always. ---------- BEGIN SOURCE ---------- import java.util.Calendar; import java.text.SimpleDateFormat; public class DateUtils { public static final String DATE_FORMAT_NOW = "yyyy-MM-dd HH:mm:ss"; public static String now() { Calendar cal = Calendar.getInstance(); SimpleDateFormat sdf = new SimpleDateFormat(DATE_FORMAT_NOW); return sdf.format(cal.getTime()); } public static void main(String arg[]) { System.out.println("Now : " + DateUtils.now()); } } ---------- END SOURCE ----------
|