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

TimeZone.getDefault().getID() doen't depend on the timezone setting on WinNT4.0J

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P4 P4
    • None
    • 1.1.7
    • core-libs



      Name: mf23781 Date: 10/05/98


      *Symptoms:

      My PC has a NT 4.0 Japanese version. Java version is "1.1.7".
      Time zone setting is EDT(GMT-5:00), and current time is 9:34:00.77.
      When I execute the following program.

      *** program ***
      import java.util.*;
      import java.text.*;

      public class test extends Object
      {
         /*---------------------------------------*/
         /* main function */
         /*---------------------------------------*/
         public static void main(String[] args)
         {
            Calendar c = Calendar.getInstance();
            DateFormat f = DateFormat.getDateTimeInstance();
            System.out.println(f.format(c.getTime()));
            System.out.println(TimeZone.getDefault().getID());
            System.out.println(f.getTimeZone().getID());
         }
      }
      *** end of program ***

      choosing Japanese from the Regional settings
      I get the following output:

      =========================================
      D:+AFw-java+AFw-work>java test
      1998/10/05 22:34:28
      JST
      JST
      =========================================

      When I change the Regional setting to U.S English my output
      is as follows:

      =========================================
      D:+AFw-java+AFw-work>java test
      05-Oct-98 6:34:06 AM
      PST
      PST
      ==========================================


      I guess that the default time zone of JDK is depending on the
      regional setting. But the regional setting is a setting for only
      representations of country dependent things such as number,
      currency, date/time format, etc... I think that default time
      zone should not depend on a regional setting but a time zone
      setting.
      ======================================================================
       

      The licensee has some extra comments :
      First of all when I run the same test case on JDK1.1.7 choosing GMT as the time
      zone of my Japanese machine from the Control Panel, and with the current time of
      17:55:16 I get the following outputs:



      "Time Zone: GMT"
      "Regional Settings: U.K. English"

      ==========================================
      P:\defects\6681
      05-Oct-98 16:55:16 AM
      GMT
      GMT
      ==========================================

      "Time Zone: GMT"
      "Regional Settings: Japanese"

      ==========================================
      P:\defects\6681
      1998/10/05 16:56:16
      GMT
      GMT
      ==========================================

      As you can see the outputs I get when I set the time zone to GMT are different
      from those I get when the time zone is EDT i.e. the time zone is correct but
      for a reason I can't understand the time I get is an hour behind than the actual
      time.

      Now the other thing I would like to mention is that on on JDK-fcs1.2-J another
      defect happens when I run the above code either choosing U.K English or
      Japanese from the Regional Settings:

      "Time Zone: GMT"
      "Regional Settings: U.K. English"

      ==========================================
      P:\defects\6681
      05-Oct-98 17:55:16 AM
      Europe/London
      Europe/London
      ==========================================

      First of all it seems that the problem we had with the time before has been
      solved, but this time we have a problem with the time zone again. Not that it's not the
      right one but I would expect to see GMT instead of Europe/London

            aliusunw Alan Liu (Inactive)
            miflemi Mick Fleming
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: