Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4297599

SimpleDateFormat.format() is inconsistent in formatting the zone_id.

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P4 P4
    • None
    • 1.1.8
    • core-libs
    • x86
    • windows_nt



      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)
      ======================================================================

            okutsu Masayoshi Okutsu
            rlewis Roger Lewis (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: