JDK-4297599 : SimpleDateFormat.format() is inconsistent in formatting the zone_id.
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.text
  • Affected Version: 1.1.8
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: windows_nt
  • CPU: x86
  • Submitted: 1999-12-07
  • Updated: 2000-11-09
  • Resolved: 2000-11-09
Related Reports
Duplicate :  
Description

Name: rlT66838			Date: 12/07/99


C:\jdk1.1.8\bin>java -version
java version "1.1.8"


The SimpleDateFormat.format method is inconsistent in formatting the zone_id.
For some timezone, it is the zone_id, such as EST, PST.  In some other case,
such as ACT, the formated output becomes "GMT+9:30".

Here is the test program to demonstrate the problem:

import java.util.*;
import java.text.*;
public class test {
        public static void main(String args[]) {
                Date dateOpened = new Date();
                SimpleDateFormat mySimpleDateFormat = new SimpleDateFormat("MMM dd yyyy HH:mm:ss zzz");
                mySimpleDateFormat.setTimeZone(TimeZone.getTimeZone("ACT"));

                System.out.println(mySimpleDateFormat.format(dateOpened));
 }
}     

Here is the output:
C:\jdk1.1.8\bin>java test
Dec 08 1999 04:41:12 GMT+09:30

The expected output is:

Dec 08 1999 04:41:12 ACT

The problem also appears on zone_id of "AGT" which becomes "GMT-3:00".
(Review ID: 98759) 
======================================================================

Comments
WORK AROUND Name: rlT66838 Date: 12/07/99 The work around that we put on our production system is to hardcode the zone_id to the input zone_id, instead of the formatted output. However, this becomes a problem when the input timezone id is EST, and the formatted output is EDT during the period when day light saving is effective. ======================================================================
11-06-2004

EVALUATION Currently, not all time zone names are provided in DateFormatZoneData. masayoshi.okutsu@Eng 2000-02-14 Display names for all time zones supported by J2SE have been provided for Ladybird. Closing this as a duplicate of 4112924. masayoshi.okutsu@Eng 2000-11-09
14-02-2000