DateTimeFormatterBuilder.appendGenericZoneText

Appends the generic time-zone name, such as 'Pacific Time', to the formatter. !(p) This appends an instruction to format/parse the generic textual name of the zone to the builder. The generic name is the same throughout the whole year, ignoring any daylight saving changes. For example, 'Pacific Time' is the generic name, whereas 'Pacific Standard Time' and 'Pacific Daylight Time' are the specific names, see {@link #appendZoneText(TextStyle)}. !(p) During formatting, the zone is obtained using a mechanism equivalent to querying the temporal with {@link TemporalQueries#zoneId()}. If the zone is a {@code ZoneOffset} it will be printed using the result of {@link ZoneOffset#getId()}. If the zone is not an offset, the textual name will be looked up for the locale set _in the {@link DateTimeFormatter}. If the lookup for text does not find any suitable result, then the {@link ZoneId#getId() ID} will be printed. If the zone cannot be obtained then an exception is thrown unless the section of the formatter is optional. !(p) During parsing, either the textual zone name, the zone ID or the offset is accepted. Many textual zone names are not unique, such as CST can be for both "Central Standard Time" and "China Standard Time". In this situation, the zone id will be determined by the region information from formatter's {@link DateTimeFormatter#getLocale() locale} and the standard zone id for that area, for example, America/New_York for the America Eastern zone. The {@link #appendGenericZoneText(TextStyle, Set)} may be used to specify a set of preferred {@link ZoneId} _in this situation.

@param textStyle the text style to use, not null @return this, for chaining, not null @since 9

  1. DateTimeFormatterBuilder appendGenericZoneText(TextStyle textStyle)
    class DateTimeFormatterBuilder
  2. DateTimeFormatterBuilder appendGenericZoneText(TextStyle textStyle, Set!(ZoneId) preferredZones)

Meta