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

TimeZone.getTimeZone is returning wrong value

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P4
    • Resolution: Not an Issue
    • Affects Version/s: 8u172
    • Fix Version/s: None
    • Component/s: core-libs
    • Subcomponent:
    • CPU:
      x86_64
    • OS:
      windows_10

      Description

      ADDITIONAL SYSTEM INFORMATION :
      Windows 10

      A DESCRIPTION OF THE PROBLEM :
      When I am trying to get time with TimeZone.getTimeZone("GMT+5:30") and formatting it with SimpleDateFormat.setTimeZone for new Date(), it is returning 2019 year.

      TimeZone.getTimeZone(GMT+5:30) = sun.util.calendar.ZoneInfo[id="GMT+05:30",offset=19800000,dstSavings=0,useDaylight=false,transitions=0,lastRule=null]
      dt = Mon Dec 31 15:09:24 IST 2018
      rdate2 = 31/12/2019 At 15:09:24

      REGRESSION : Last worked in version 8u172

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      SimpleDateFormat dtFormatDate1 =new SimpleDateFormat("dd/MM/YYYY");
      SimpleDateFormat dtFormatTime1 =new SimpleDateFormat("HH:mm:ss");
      dtFormatDate1.setTimeZone(TimeZone.getTimeZone("GMT+5:30"));
      dtFormatTime1.setTimeZone(TimeZone.getTimeZone("GMT+5:30"));
      String rdate2 = dtFormatDate1.format(dt)+" At "+ dtFormatTime1.format(dt);
      System.out.println("rdate2 = "+rdate2);

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      rdate2 = 31/12/2018 At 15:09:24
      ACTUAL -
      rdate2 = 31/12/2019 At 15:09:24

      FREQUENCY : rarely


        Attachments

          Activity

            People

            • Assignee:
              psonal Pallavi Sonal
              Reporter:
              webbuggrp Webbug Group
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: