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

Singapore Timezone not recognized by java

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P3 P3
    • None
    • 1.2.1
    • core-libs
    • None
    • sparc
    • solaris_7

      The Singapore Timezone does not appear to be recognized by java.

      For example, take this test program (partly stolen from another bug report):

      import java.util.Date;
      import java.util.TimeZone;
       
      public class date {
          public static void main(String argv[]) {
              Date d = new Date();
              System.out.println("java date: " + d.toString());
              System.out.println("java timezone: " + TimeZone.getDefault().getID());
          }
      }

      Testing with Solaris_JDK_1.2.1_04c and Solaris_JDK_1.2.1_03a, we get this:

      $ TZ=Singapore;export TZ
      $ date
      Thu Jun 15 22:36:41 SGT 2000
      $ java date
      java date: Thu Jun 15 22:36:45 CST 2000
      java timezone: Asia/Shanghai

      It comes up with China Standard Time, which is the same offset.

      If we explicitly tell java the timezone, we get this:

      $ java -Duser.timezone=Asia/Singapore date
      java date: Thu Jun 15 22:37:45 GMT+08:00 2000
      java timezone: Asia/Singapore


      For a workaround, we recompiled the DateFormatZoneData_en_US.class file and put it in /usr/java/jre/classes/java/text/resources. (See workaround for changes). We can get the timezone abbreviation to come up correctly, but only if we explicitly set the user.timezone.

      $ TZ=Singapore;export TZ
      $ java date
      java date: Thu Jun 15 22:54:27 CST 2000
      java timezone: Asia/Shanghai
      $ java -Duser.timezone=Asia/Singapore date
      java date: Thu Jun 15 22:54:46 SGT 2000
      java timezone: Asia/Singapore

            okutsu Masayoshi Okutsu
            pwernau Paul Wernau (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: