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

TimeZone.getDefault() should reflect startDayOfWeek and endDayOfWeek of TZ

XMLWordPrintable

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



      Name: dk106046 Date: 01/12/2004

      The problem reported is that the TimeZone.getDefault() doesn't reflect the rules part (startDayOfWeek and endDayOfWeek) of the TZ environmental variable.

      Please find below a small testcase which displays the default timezone information.

      import java.util.*;
      public class test {
              public static void main(String args[]) {
                      System.out.println( "\nJava default Timezone=" +
                                 TimeZone.getDefault() );

      System.out.println("\n Java date=" +
                                      (new java.util.Date()) );
             }
      }

      A sample run is as follows:

      $export TZ=NZST-12NZDT,M10.1.0,M3.3.1
      $
      $ java test

      Java default Timezone=java.util.SimpleTimeZone[id=Pacific/Auckland,offset=43200000,dstSavings=3600000,useDaylight=true,startYear=0,startMode=3,startMonth=9,startDay=1,startDayOfWeek=1,startTime=7200000,startTimeMode=1,endMode=3,endMonth=2,endDay=15,endDayOfWeek=1,endTime=7200000,endTimeMode=1]

      Java date=Wed Jan 07 22:45:36 NZDT 2004
      $

      Notice that the startdayofweek/EnddayofWeek do not reflect that in the TZ env variable.

      ======================================================================

            okutsu Masayoshi Okutsu
            dkorbel David Korbel (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: