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

Java Singapore/KL timezone seems to be wrong

XMLWordPrintable

    • generic
    • generic

      A DESCRIPTION OF THE PROBLEM :
      Running the following code:
      System.setProperty("user.timezone", "Asia/Singapore");
      System.out.println(new Timestamp(0L));

      The expected output is 1970-01-01 08:00:00.0
      but the output is currently 1970-01-01 07:30:00.0


      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      System.setProperty("user.timezone", "Asia/Singapore");
      System.out.println(new Timestamp(0L));

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      1970-01-01 08:00:00.0
      ACTUAL -
      1970-01-01 07:30:00.0

      ---------- BEGIN SOURCE ----------
      /* package whatever; // don't place package name! */

      import java.util.*;
      import java.lang.*;
      import java.io.*;
      import java.sql.*;

      /* Name of the class has to be "Main" only if the class is public. */
      class Ideone
      {
      public static void main (String[] args) throws java.lang.Exception
      {
      System.setProperty("user.timezone", "Asia/Singapore");
      System.out.println(new Timestamp(0L));
      }
      }
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      Use another GMT+8 timezone

            lancea Lance Andersen
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: