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

IST mapped to wrong ZoneId in java.time library

XMLWordPrintable

    • generic
    • generic

      ADDITIONAL SYSTEM INFORMATION :
      JDK 12

      A DESCRIPTION OF THE PROBLEM :
      I am trying to parse a ZonedDateTime from a String of the format (yyyy-MM-dd HH:mm z). The input String (2019-08-29 00:00 IST) generates a UTC timestamp.

      Debugging led me to a point where the ZoneId for IST was mapped to Atlantic/Reykjavik which doesn't make sense. It should be mapped Asia.



      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      It can be reproduced as follows -
      timestamp = ZonedDateTime.parse(timeInput, DATE_WITH_TIMEZONE_FORMATTER)
                  .toInstant().toEpochMilli()
      where

      DateTimeFormatter DATE_WITH_TIMEZONE_FORMATTER = DateTimeFormatter
            .ofPattern(DATE_TIME_WITH_TIMEZONE_PATTERN).withChronology(IsoChronology.INSTANCE);


      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Expecting the output to be in IST
      ACTUAL -
      Zone Id is Atlantic/Reykjavik

            psonal Pallavi Sonal (Inactive)
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: