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

Zone text formatting can be more effective


    • Type: Enhancement
    • Status: Resolved
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: 9
    • Fix Version/s: None
    • Component/s: core-libs
    • Labels:


      ZoneTextPrinterParser contains logic (line 3689 in JDK 8) to determine whether the temporal being formatted can supply INSTANT_SECONDS. If it can, then the instant is queried and used to output the "specific non-location" format (DST or STD). If the temporal cannot supply INSTANT_SECONDS, then the "generic non-location" format (GENERIC) is used. See LDML for the terminology - http://www.unicode.org/reports/tr35/tr35-43/tr35-dates.html#Time_Zone_Format_Terminology.

      This code can be more intelligent. If the input temporal is a ChronoLocalDateTime, then the DST status can be determined in all cases except the DST overlap. The logic would be:

      if (dt.isSupported(INSTANT_SECONDS)) {
        // use Instant.from(dt) to determine whether DST or STD
        // ie. the current logic
      } else if (dt instanceof ChronoLocalDateTime) {
        // use LocalDateTime.from(dt) to determine the date-time
        // use ZoneRules.getTransition(localDateTime) to check if in a DST overlap, thus needing to use GENERIC
        // convert LocalDateTime to an Instant and determine DST or STD as per current logic
      } else {
        // use GENERIC

      See also http://stackoverflow.com/questions/36722873/datetimeformatter-not-compatible-with-simpledateformat/36724122

        Issue Links


          ntv Nadeesh Tv (Inactive) added a comment - http://mail.openjdk.java.net/pipermail/core-libs-dev/2016-May/040924.html
          ntv Nadeesh Tv (Inactive) added a comment - Fixed as part of https://bugs.openjdk.java.net/browse/JDK-8155823


            • Assignee:
              ntv Nadeesh Tv (Inactive)
              scolebourne Stephen Colebourne
            • Votes:
              0 Vote for this issue
              2 Start watching this issue


              • Created: