Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8247781 Day periods support
  3. JDK-8255971

Release Note: Day Period Support Added to java.time Formats

XMLWordPrintable

    • generic
    • generic

      A new formatter pattern, letter 'B', and its supporting method have been added to `java.time.format.DateTimeFormatter/DateTimeFormatterBuilder` classes. The pattern and method translate `day periods` defined in Unicode Consortium's CLDR (https://unicode.org/reports/tr35/tr35-dates.html#dayPeriods). Applications can now express periods in a day, such as "in the morning" or "at night", not just am/pm. The following example demonstrates translating the day periods:
      ```
      DateTimeFormatter.ofPattern("B").format(LocalTime.now())
      ```
      This example produces day period text depending on the time of the day and locale.

            naoto Naoto Sato
            naoto Naoto Sato
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: