-
Type:
Sub-task
-
Resolution: Delivered
-
Priority:
P4
-
Affects Version/s: 16
-
Component/s: core-libs
-
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.
```
DateTimeFormatter.ofPattern("B").format(LocalTime.now())
```
This example produces day period text depending on the time of the day and locale.