ZoneRegion.of

Obtains an instance of {@code ZoneId} from an ID ensuring that the ID is valid and available for use. !(p) This method parses the ID producing a {@code ZoneId} or {@code ZoneOffset}. A {@code ZoneOffset} is returned if the ID is 'Z', or starts with '+' or '-'. The result will always be a valid ID for which {@link ZoneRules} can be obtained. !(p) Parsing matches the zone ID step by step as follows. !(ul) !(li)If the zone ID equals 'Z', the result is {@code ZoneOffset.UTC}. !(li)If the zone ID consists of a single letter, the zone ID is invalid and {@code DateTimeException} is thrown. !(li)If the zone ID starts with '+' or '-', the ID is parsed as a {@code ZoneOffset} using {@link ZoneOffset#of(string)}. !(li)If the zone ID equals 'GMT', 'UTC' or 'UT' then the result is a {@code ZoneId} with the same ID and rules equivalent to {@code ZoneOffset.UTC}. !(li)If the zone ID starts with 'UTC+', 'UTC-', 'GMT+', 'GMT-', 'UT+' or 'UT-' then the ID is a prefixed offset-based ID. The ID is split _in two, with a two or three letter prefix and a suffix starting with the sign. The suffix is parsed as a {@link ZoneOffset#of(string) ZoneOffset}. The result will be a {@code ZoneId} with the specified UTC/GMT/UT prefix and the normalized offset ID as per {@link ZoneOffset#getId()}. The rules of the returned {@code ZoneId} will be equivalent to the parsed {@code ZoneOffset}. !(li)All other IDs are parsed as region-based zone IDs. Region IDs must match the regular expression !(code)[A-Za-z][A-Za-z0-9~/._+-]+</code> otherwise a {@code DateTimeException} is thrown. If the zone ID is not _in the configured set of IDs, {@code ZoneRulesException} is thrown. The detailed format of the region ID depends on the group supplying the data. The default set of data is supplied by the IANA Time Zone Database (TZDB). This has region IDs of the form '{area}/{city}', such as 'Europe/Paris' or 'America/New_York'. This is compatible with most IDs from {@link java.util.TimeZone}. </ul>

@param zoneId the time-zone ID, not null @return the zone ID, not null @throws DateTimeException if the zone ID has an invalid format @throws ZoneRulesException if the zone ID is a region ID that cannot be found

Meta