JDK-4071776 : The default TimeZone for DateFormat is PST
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.text
  • Affected Version: 1.1.3
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • OS: solaris_2.5.1
  • CPU: sparc
  • Submitted: 1997-08-14
  • Updated: 1997-10-23
  • Resolved: 1997-10-23
Related Reports
Duplicate :  
Relates :  
Description
The following code:
------
                DateFormat dateFormatter =
                DateFormat.getTimeInstance(DateFormat.DEFAULT, Locale.US);
                TimeZone formatTZ = dateFormatter.getTimeZone();
                System.out.println("2:Format=" + formatTZ.getID());
------
Produces
---------
2:Format=PST
--------------
You get the same result with 1 and 0 argument versions of getTimeInstance().
The expected result is the TimeZone of the local machine (in my case EST). You can achieve this result by getting the correct default via 'TimeZone.getDefault()' and then use the DateFormat.setTimeZone(). However it is extremely rare that you want to display the time using a TimeZone different from your own, so this logic should be built into the default.