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

Java display an hour off from system date when TZ env var is set on linux

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not an Issue
    • Icon: P3 P3
    • None
    • 8u261
    • core-libs

      Java displays an hour off (+1) from the system date when
      TZ environment variable is set to any time zone.

      Java displays time correctly as the system time when
      there is no TZ variable set in the environment.

      On solaris sparc 64bit platform
      Java works fine regardless of TZ being set.


      Example:

      export TZ="EST+5EDT,M3.2.0/2,M11.1.0/2"

      and running :

      import java.util.Date;

      class ExampleDate {
        public static void main(String[] args) {
          Date today = new Date();
          System.out.println(today);
        }
      }

      gives different result to system date(date)

            kravikumar Kiran Sidhartha Ravikumar (Inactive)
            shadowbug Shadow Bug
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: