# ZoneId

public abstract class **ZoneId** extends [Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html)  
implements [Serializable](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/Serializable.html)

|---|---|---|
| Known Direct Subclasses [ZoneOffset](https://developers.google.com/j2objc/javadoc/jre/reference/java/time/ZoneOffset.html) |---|---| | [ZoneOffset](https://developers.google.com/j2objc/javadoc/jre/reference/java/time/ZoneOffset.html) | A time-zone offset from Greenwich/UTC, such as `+02:00`. | |||

A time-zone ID, such as `Europe/Paris`.


A `ZoneId` is used to identify the rules used to convert between
an `https://developers.google.com/j2objc/javadoc/jre/reference/java/time/Instant.html` and a `https://developers.google.com/j2objc/javadoc/jre/reference/java/time/LocalDateTime.html`.
There are two distinct types of ID:

- Fixed offsets - a fully resolved offset from UTC/Greenwich, that uses the same offset for all local date-times
- Geographical regions - an area where a specific set of rules for finding the offset from UTC/Greenwich apply

Most fixed offsets are represented by `https://developers.google.com/j2objc/javadoc/jre/reference/java/time/ZoneOffset.html`. Calling `https://developers.google.com/j2objc/javadoc/jre/reference/java/time/ZoneId.html#normalized()` on any `ZoneId` will ensure that a fixed offset ID will be represented as a `ZoneOffset`.


The actual rules, describing when and how the offset changes, are defined by `https://developers.google.com/j2objc/javadoc/jre/reference/java/time/zone/ZoneRules.html`.
This class is simply an ID used to obtain the underlying rules.
This approach is taken because rules are defined by governments and change
frequently, whereas the ID is stable.


The distinction has other effects. Serializing the `ZoneId` will only send
the ID, whereas serializing the rules sends the entire data set.
Similarly, a comparison of two IDs only examines the ID, whereas
a comparison of two rules examines the entire data set.

### Time-zone IDs

The ID is unique within the system. There are three types of ID.


The simplest type of ID is that from `ZoneOffset`.
This consists of 'Z' and IDs starting with '+' or '-'.


The next type of ID are offset-style IDs with some form of prefix,
such as 'GMT+2' or 'UTC+01:00'.
The recognised prefixes are 'UTC', 'GMT' and 'UT'.
The offset is the suffix and will be normalized during creation.
These IDs can be normalized to a `ZoneOffset` using `normalized()`.


The third type of ID are region-based IDs. A region-based ID must be of
two or more characters, and not start with 'UTC', 'GMT', 'UT' '+' or '-'.
Region-based IDs are defined by configuration.
The configuration focuses on providing the lookup from the ID to the
underlying `ZoneRules`.


Time-zone rules are defined by governments and change frequently.
There are a number of organizations, known here as groups, that monitor
time-zone changes and collate them.
The default group is the IANA Time Zone Database (TZDB).
Other organizations include IATA (the airline industry body) and Microsoft.


Each group defines its own format for the region ID it provides.
The TZDB group defines IDs such as 'Europe/London' or 'America/New_York'.
TZDB IDs take precedence over other groups.


It is strongly recommended that the group name is included in all IDs supplied by
groups other than TZDB to avoid conflicts. For example, IATA airline time-zone
region IDs are typically the same as the three letter airport code.
However, the airport of Utrecht has the code 'UTC', which is obviously a conflict.
The recommended format for region IDs from groups other than TZDB is 'group\~region'.
Thus if IATA data were defined, Utrecht airport would be 'IATA\~UTC'.

### Serialization

This class can be serialized and stores the string zone ID in the external form. The `ZoneOffset` subclass uses a dedicated format that only stores the offset from UTC/Greenwich.


A `ZoneId` can be deserialized in a Java Runtime where the ID is unknown.
For example, if a server-side Java Runtime has been updated with a new zone ID, but
the client-side Java Runtime has not been updated. In this case, the `ZoneId`
object will exist, and can be queried using `getId`, `equals`,
`hashCode`, `toString`, `getDisplayName` and `normalized`.
However, any call to `getRules` will fail with `ZoneRulesException`.
This approach is designed to allow a `https://developers.google.com/j2objc/javadoc/jre/reference/java/time/ZonedDateTime.html` to be loaded and
queried, but not modified, on a Java Runtime with incomplete time-zone information.

### Field Summary

|---|---|---|
| public static final [Map](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Map.html)\<[String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html), [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html)\> | [SHORT_IDS](https://developers.google.com/j2objc/javadoc/jre/reference/java/time/ZoneId.html#SHORT_IDS) | A map of zone overrides to enable the short time-zone names to be used. |

### Public Method Summary

|---|---|
| boolean | [equals](https://developers.google.com/j2objc/javadoc/jre/reference/java/time/ZoneId.html#equals(java.lang.Object))([Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html) obj) Checks if this time-zone ID is equal to another time-zone ID. |
| static [ZoneId](https://developers.google.com/j2objc/javadoc/jre/reference/java/time/ZoneId.html) | [from](https://developers.google.com/j2objc/javadoc/jre/reference/java/time/ZoneId.html#from(java.time.temporal.TemporalAccessor))([TemporalAccessor](https://developers.google.com/j2objc/javadoc/jre/reference/java/time/temporal/TemporalAccessor.html) temporal) Obtains an instance of `ZoneId` from a temporal object. |
| static [Set](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Set.html)\<[String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html)\> | [getAvailableZoneIds](https://developers.google.com/j2objc/javadoc/jre/reference/java/time/ZoneId.html#getAvailableZoneIds())() Gets the set of available zone IDs. |
| [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) | [getDisplayName](https://developers.google.com/j2objc/javadoc/jre/reference/java/time/ZoneId.html#getDisplayName(java.time.format.TextStyle,%20java.util.Locale))([TextStyle](https://developers.google.com/j2objc/javadoc/jre/reference/java/time/format/TextStyle.html) style, [Locale](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Locale.html) locale) Gets the textual representation of the zone, such as 'British Time' or '+02:00'. |
| abstract [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) | [getId](https://developers.google.com/j2objc/javadoc/jre/reference/java/time/ZoneId.html#getId())() Gets the unique time-zone ID. |
| abstract [ZoneRules](https://developers.google.com/j2objc/javadoc/jre/reference/java/time/zone/ZoneRules.html) | [getRules](https://developers.google.com/j2objc/javadoc/jre/reference/java/time/ZoneId.html#getRules())() Gets the time-zone rules for this ID allowing calculations to be performed. |
| int | [hashCode](https://developers.google.com/j2objc/javadoc/jre/reference/java/time/ZoneId.html#hashCode())() A hash code for this time-zone ID. |
| [ZoneId](https://developers.google.com/j2objc/javadoc/jre/reference/java/time/ZoneId.html) | [normalized](https://developers.google.com/j2objc/javadoc/jre/reference/java/time/ZoneId.html#normalized())() Normalizes the time-zone ID, returning a `ZoneOffset` where possible. |
| static [ZoneId](https://developers.google.com/j2objc/javadoc/jre/reference/java/time/ZoneId.html) | [of](https://developers.google.com/j2objc/javadoc/jre/reference/java/time/ZoneId.html#of(java.lang.String,%20java.util.Map<java.lang.String,%20java.lang.String>))([String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) zoneId, [Map](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Map.html)\<[String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html), [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html)\> aliasMap) Obtains an instance of `ZoneId` using its ID using a map of aliases to supplement the standard zone IDs. |
| static [ZoneId](https://developers.google.com/j2objc/javadoc/jre/reference/java/time/ZoneId.html) | [of](https://developers.google.com/j2objc/javadoc/jre/reference/java/time/ZoneId.html#of(java.lang.String))([String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) zoneId) Obtains an instance of `ZoneId` from an ID ensuring that the ID is valid and available for use. |
| static [ZoneId](https://developers.google.com/j2objc/javadoc/jre/reference/java/time/ZoneId.html) | [ofOffset](https://developers.google.com/j2objc/javadoc/jre/reference/java/time/ZoneId.html#ofOffset(java.lang.String,%20java.time.ZoneOffset))([String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) prefix, [ZoneOffset](https://developers.google.com/j2objc/javadoc/jre/reference/java/time/ZoneOffset.html) offset) Obtains an instance of `ZoneId` wrapping an offset. |
| static [ZoneId](https://developers.google.com/j2objc/javadoc/jre/reference/java/time/ZoneId.html) | [systemDefault](https://developers.google.com/j2objc/javadoc/jre/reference/java/time/ZoneId.html#systemDefault())() Gets the system default time-zone. |
| [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) | [toString](https://developers.google.com/j2objc/javadoc/jre/reference/java/time/ZoneId.html#toString())() Outputs this zone as a `String`, using the ID. |
| static [ZoneId](https://developers.google.com/j2objc/javadoc/jre/reference/java/time/ZoneId.html) | [toZoneId](https://developers.google.com/j2objc/javadoc/jre/reference/java/time/ZoneId.html#toZoneId(java.util.TimeZone))([TimeZone](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/TimeZone.html) tz) J2ObjC: moved from java.util to keep jre_core independent of jre_time. |

### Inherited Method Summary

From class [java.lang.Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html)

|---|---|
| [Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html) | [clone](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#clone())() Creates and returns a copy of this `Object`. |
| boolean | [equals](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#equals(java.lang.Object))([Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html) obj) Compares this instance with the specified object and indicates if they are equal. |
| void | [finalize](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#finalize())() Invoked when the garbage collector has detected that this instance is no longer reachable. |
| final [Class](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Class.html)\<?\> | [getClass](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#getClass())() Returns the unique instance of `https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Class.html` that represents this object's class. |
| int | [hashCode](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#hashCode())() Returns an integer hash code for this object. |
| final void | [notify](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#notify())() Causes a thread which is waiting on this object's monitor (by means of calling one of the `wait()` methods) to be woken up. |
| final void | [notifyAll](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#notifyAll())() Causes all threads which are waiting on this object's monitor (by means of calling one of the `wait()` methods) to be woken up. |
| [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) | [toString](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#toString())() Returns a string containing a concise, human-readable description of this object. |
| final void | [wait](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#wait(long,%20int))(long timeout, int nanos) Causes the calling thread to wait until another thread calls the `notify()` or `notifyAll()` method of this object or until the specified timeout expires. |
| final void | [wait](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#wait(long))(long timeout) Causes the calling thread to wait until another thread calls the `notify()` or `notifyAll()` method of this object or until the specified timeout expires. |
| final void | [wait](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#wait())() Causes the calling thread to wait until another thread calls the `notify()` or `notifyAll()` method of this object. |

## Fields

#### public static final [Map](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Map.html)\<[String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html), [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html)\>
**SHORT_IDS**

A map of zone overrides to enable the short time-zone names to be used.


Use of short zone IDs has been deprecated in `java.util.TimeZone`.
This map allows the IDs to continue to be used via the
`https://developers.google.com/j2objc/javadoc/jre/reference/java/time/ZoneId.html#of(java.lang.String,%20java.util.Map<java.lang.String,%20java.lang.String>)` factory method.


This map contains a mapping of the IDs that is in line with TZDB 2005r and
later, where 'EST', 'MST' and 'HST' map to IDs which do not include daylight
savings.


This maps as follows:

- EST - -05:00
- HST - -10:00
- MST - -07:00
- ACT - Australia/Darwin
- AET - Australia/Sydney
- AGT - America/Argentina/Buenos_Aires
- ART - Africa/Cairo
- AST - America/Anchorage
- BET - America/Sao_Paulo
- BST - Asia/Dhaka
- CAT - Africa/Harare
- CNT - America/St_Johns
- CST - America/Chicago
- CTT - Asia/Shanghai
- EAT - Africa/Addis_Ababa
- ECT - Europe/Paris
- IET - America/Indiana/Indianapolis
- IST - Asia/Kolkata
- JST - Asia/Tokyo
- MIT - Pacific/Apia
- NET - Asia/Yerevan
- NST - Pacific/Auckland
- PLT - Asia/Karachi
- PNT - America/Phoenix
- PRT - America/Puerto_Rico
- PST - America/Los_Angeles
- SST - Pacific/Guadalcanal
- VST - Asia/Ho_Chi_Minh

The map is unmodifiable.

<br />

## Public Methods

#### public boolean
**equals**
([Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html) obj)

Checks if this time-zone ID is equal to another time-zone ID.


The comparison is based on the ID.

##### Parameters

| obj | the object to check, null returns false |
|---|---|

##### Returns

- true if this is equal to the other time-zone ID

#### public static [ZoneId](https://developers.google.com/j2objc/javadoc/jre/reference/java/time/ZoneId.html)
**from**
([TemporalAccessor](https://developers.google.com/j2objc/javadoc/jre/reference/java/time/temporal/TemporalAccessor.html) temporal)

Obtains an instance of `ZoneId` from a temporal object.


This obtains a zone based on the specified temporal.
A `TemporalAccessor` represents an arbitrary set of date and time information,
which this factory converts to an instance of `ZoneId`.


A `TemporalAccessor` represents some form of date and time information.
This factory converts the arbitrary temporal object to an instance of `ZoneId`.


The conversion will try to obtain the zone in a way that favours region-based
zones over offset-based zones using `https://developers.google.com/j2objc/javadoc/jre/reference/java/time/temporal/TemporalQueries.html#zone()`.


This method matches the signature of the functional interface `https://developers.google.com/j2objc/javadoc/jre/reference/java/time/temporal/TemporalQuery.html`
allowing it to be used as a query via method reference, `ZoneId::from`.

##### Parameters

| temporal | the temporal object to convert, not null |
|---|---|

##### Returns

- the zone ID, not null

##### Throws

| [DateTimeException](https://developers.google.com/j2objc/javadoc/jre/reference/java/time/DateTimeException.html) | if unable to convert to a `ZoneId` |
|---|---|

#### public static [Set](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Set.html)\<[String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html)\>
**getAvailableZoneIds**
()

Gets the set of available zone IDs.


This set includes the string form of all available region-based IDs.
Offset-based zone IDs are not included in the returned set.
The ID can be passed to `https://developers.google.com/j2objc/javadoc/jre/reference/java/time/ZoneId.html#of(java.lang.String)` to create a `ZoneId`.


The set of zone IDs can increase over time, although in a typical application
the set of IDs is fixed. Each call to this method is thread-safe.

##### Returns

- a modifiable copy of the set of zone IDs, not null

#### public [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html)
**getDisplayName**
([TextStyle](https://developers.google.com/j2objc/javadoc/jre/reference/java/time/format/TextStyle.html) style, [Locale](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Locale.html) locale)

Gets the textual representation of the zone, such as 'British Time' or
'+02:00'.


This returns the textual name used to identify the time-zone ID,
suitable for presentation to the user.
The parameters control the style of the returned text and the locale.


If no textual mapping is found then the `https://developers.google.com/j2objc/javadoc/jre/reference/java/time/ZoneId.html#getId()` is returned.

##### Parameters

| style | the length of the text required, not null |
| locale | the locale to use, not null |
|---|---|

##### Returns

- the text value of the zone, not null

#### public abstract [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html)
**getId**
()

Gets the unique time-zone ID.


This ID uniquely defines this object.
The format of an offset based ID is defined by `https://developers.google.com/j2objc/javadoc/jre/reference/java/time/ZoneOffset.html#getId()`.

##### Returns

- the time-zone unique ID, not null

#### public abstract [ZoneRules](https://developers.google.com/j2objc/javadoc/jre/reference/java/time/zone/ZoneRules.html)
**getRules**
()

Gets the time-zone rules for this ID allowing calculations to be performed.


The rules provide the functionality associated with a time-zone,
such as finding the offset for a given instant or local date-time.


A time-zone can be invalid if it is deserialized in a Java Runtime which
does not have the same rules loaded as the Java Runtime that stored it.
In this case, calling this method will throw a `ZoneRulesException`.


`https://developers.google.com/j2objc/javadoc/jre/reference/java/time/ZoneOffset.html` will always return a set of rules where the offset never changes.

##### Returns

- the rules, not null

##### Throws

| [ZoneRulesException](https://developers.google.com/j2objc/javadoc/jre/reference/java/time/zone/ZoneRulesException.html) | if no rules are available for this ID |
|---|---|

#### public int
**hashCode**
()

A hash code for this time-zone ID.

##### Returns

- a suitable hash code

#### public [ZoneId](https://developers.google.com/j2objc/javadoc/jre/reference/java/time/ZoneId.html)
**normalized**
()

Normalizes the time-zone ID, returning a `ZoneOffset` where possible.


The returns a normalized `ZoneId` that can be used in place of this ID.
The result will have `ZoneRules` equivalent to those returned by this object,
however the ID returned by `getId()` may be different.


The normalization checks if the rules of this `ZoneId` have a fixed offset.
If they do, then the `ZoneOffset` equal to that offset is returned.
Otherwise `this` is returned.

##### Returns

- the time-zone unique ID, not null

#### public static [ZoneId](https://developers.google.com/j2objc/javadoc/jre/reference/java/time/ZoneId.html)
**of**
([String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) zoneId, [Map](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Map.html)\<[String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html), [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html)\> aliasMap)

Obtains an instance of `ZoneId` using its ID using a map
of aliases to supplement the standard zone IDs.


Many users of time-zones use short abbreviations, such as PST for
'Pacific Standard Time' and PDT for 'Pacific Daylight Time'.
These abbreviations are not unique, and so cannot be used as IDs.
This method allows a map of string to time-zone to be setup and reused
within an application.

##### Parameters

| zoneId | the time-zone ID, not null |
| aliasMap | a map of alias zone IDs (typically abbreviations) to real zone IDs, not null |
|---|---|

##### Returns

- the zone ID, not null

##### Throws

| [DateTimeException](https://developers.google.com/j2objc/javadoc/jre/reference/java/time/DateTimeException.html) | if the zone ID has an invalid format |
| [ZoneRulesException](https://developers.google.com/j2objc/javadoc/jre/reference/java/time/zone/ZoneRulesException.html) | if the zone ID is a region ID that cannot be found |
|---|---|

#### public static [ZoneId](https://developers.google.com/j2objc/javadoc/jre/reference/java/time/ZoneId.html)
**of**
([String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) zoneId)

Obtains an instance of `ZoneId` from an ID ensuring that the
ID is valid and available for use.


This method parses the ID producing a `ZoneId` or `ZoneOffset`.
A `ZoneOffset` is returned if the ID is 'Z', or starts with '+' or '-'.
The result will always be a valid ID for which `https://developers.google.com/j2objc/javadoc/jre/reference/java/time/zone/ZoneRules.html` can be obtained.


Parsing matches the zone ID step by step as follows.

- If the zone ID equals 'Z', the result is `ZoneOffset.UTC`.
- If the zone ID consists of a single letter, the zone ID is invalid and `DateTimeException` is thrown.
- If the zone ID starts with '+' or '-', the ID is parsed as a `ZoneOffset` using `https://developers.google.com/j2objc/javadoc/jre/reference/java/time/ZoneOffset.html#of(java.lang.String)`.
- If the zone ID equals 'GMT', 'UTC' or 'UT' then the result is a `ZoneId` with the same ID and rules equivalent to `ZoneOffset.UTC`.
- 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 `https://developers.google.com/j2objc/javadoc/jre/reference/java/time/ZoneOffset.html#of(java.lang.String)`. The result will be a `ZoneId` with the specified UTC/GMT/UT prefix and the normalized offset ID as per `https://developers.google.com/j2objc/javadoc/jre/reference/java/time/ZoneOffset.html#getId()`. The rules of the returned `ZoneId` will be equivalent to the parsed `ZoneOffset`.
- All other IDs are parsed as region-based zone IDs. Region IDs must match the regular expression `[A-Za-z][A-Za-z0-9~/._+-]+` otherwise a `DateTimeException` is thrown. If the zone ID is not in the configured set of IDs, `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 `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/TimeZone.html`.

<br />

##### Parameters

| zoneId | the time-zone ID, not null |
|---|---|

##### Returns

- the zone ID, not null

##### Throws

| [DateTimeException](https://developers.google.com/j2objc/javadoc/jre/reference/java/time/DateTimeException.html) | if the zone ID has an invalid format |
| [ZoneRulesException](https://developers.google.com/j2objc/javadoc/jre/reference/java/time/zone/ZoneRulesException.html) | if the zone ID is a region ID that cannot be found |
|---|---|

#### public static [ZoneId](https://developers.google.com/j2objc/javadoc/jre/reference/java/time/ZoneId.html)
**ofOffset**
([String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) prefix, [ZoneOffset](https://developers.google.com/j2objc/javadoc/jre/reference/java/time/ZoneOffset.html) offset)

Obtains an instance of `ZoneId` wrapping an offset.


If the prefix is "GMT", "UTC", or "UT" a `ZoneId`
with the prefix and the non-zero offset is returned.
If the prefix is empty `""` the `ZoneOffset` is returned.

##### Parameters

| prefix | the time-zone ID, not null |
| offset | the offset, not null |
|---|---|

##### Returns

- the zone ID, not null

##### Throws

| [IllegalArgumentException](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/IllegalArgumentException.html) | if the prefix is not one of "GMT", "UTC", or "UT", or "" |
|---|---|

#### public static [ZoneId](https://developers.google.com/j2objc/javadoc/jre/reference/java/time/ZoneId.html)
**systemDefault**
()

Gets the system default time-zone.


This queries `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/TimeZone.html#getDefault()` to find the default time-zone
and converts it to a `ZoneId`. If the system default time-zone is changed,
then the result of this method will also change.

##### Returns

- the zone ID, not null

##### Throws

| [DateTimeException](https://developers.google.com/j2objc/javadoc/jre/reference/java/time/DateTimeException.html) | if the converted zone ID has an invalid format |
| [ZoneRulesException](https://developers.google.com/j2objc/javadoc/jre/reference/java/time/zone/ZoneRulesException.html) | if the converted zone region ID cannot be found |
|---|---|

#### public [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html)
**toString**
()

Outputs this zone as a `String`, using the ID.

##### Returns

- a string representation of this time-zone ID, not null

#### public static [ZoneId](https://developers.google.com/j2objc/javadoc/jre/reference/java/time/ZoneId.html)
**toZoneId**
([TimeZone](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/TimeZone.html) tz)

J2ObjC: moved from java.util to keep jre_core independent of jre_time.
Converts a `TimeZone` object to a `ZoneId`.

##### Parameters

| tz |   |
|---|---|

##### Returns

- a `ZoneId` representing the same time zone as this `TimeZone`