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

java.util.Date always returns PDT & getTimezoneOffset() is behaving strangely.

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P3 P3
    • None
    • 1.1.2
    • core-libs



      Name: tb29552 Date: 06/17/97


      Regardless of what the current time/timezone is set to on
      my computer, java.util.Date returns Pacific Daylight Time.
      I have been unable to return the actual time (Central European
      Time) at all. Also, notice the return value of getTimezoneOffset()
      in the below code.

      ...

      public static void main(String argv[]) {
        Date now = new Date();

        System.out.println("Now: " + now);
        System.out.println("TimezoneOffset: " + now.getTimezoneOffset() / 60);
      }

      The above returns (at 2:25pm CET on June 16):
        Now: Mon Jun 16 05:21:34 PDT 1997
        TimezoneOffset: -1

      Shouldn't the TimezoneOffset be +1 for CET??
      company - UI Design AB , email - ###@###.###
      ======================================================================

            aliusunw Alan Liu (Inactive)
            tbell Tim Bell
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: