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

RFE: Request for a new method: TimeZone.getOffset(Date)

XMLWordPrintable

    • beta
    • generic
    • generic



      Name: wl91122 Date: 09/02/99


      Currently, TimeZone has only one "getOffset" method:

      <pre>
      public abstract int getOffset(int era,
                                    int year,
                                    int month,
                                    int day,
                                    int dayOfWeek,
                                    int milliseconds)
      </pre>

      This method seem to be a source of confusion for numerous developper.
      Please see the evaluation for bug #4154652. The evaluator said "This
      method should never have been made public". Please see also bug #4228598.
      In some situations, we need to know the timezone offset for a given date. But
      the current "getOffset" method is not very convenient. I would like to make two
      suggestions:

      1) Deprecate the current "getOffset(int,int,int,int,int,int)" method.
      2) Add a "getOffset(Date)" method.

      The new "getOffset(Date)" method would be easier to use, less error-prone, and
      coherent with the current "inDaylightTime(Date)" method. If it is ok the use
      "inDaylightTime(Date)" with a Date parameter, I don't see why it would not be
      ok to give a Date parameter to "getOffset(Date)".
      (Review ID: 94783)
      ======================================================================

            okutsu Masayoshi Okutsu
            wleesunw William Lee (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: