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

TimeZone.getDefault() behavior not as documented

XMLWordPrintable

    • x86, sparc
    • solaris_2.6, windows_95



      Name: dgC58589 Date: 01/21/98


      This program returns "time zone = GMT offset=0" when I'm in Colorado.

      import java.util.TimeZone ;
      public class tzbug
      {
      public static void main(String args[]) throws Exception
      {
      TimeZone tz = TimeZone.getDefault() ;
      System.out.println("time zone = " + tz.getID() + " offset=" + tz.getRawOffset()) ;
      }
      }

         Documentation for Java.util.TimeZone says :

      Typically, you get a TimeZone using getDefault which creates a TimeZone based on the time zone where the program is running. For example, for a program running in Japan, getDefault creates a TimeZone object based on Japanese Standard Time.

         which implies that java should get MDT from the system.
      (Review ID: 23541)
      ======================================================================

            aliusunw Alan Liu (Inactive)
            dgrahamcsunw David Graham-cumming (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: