Added in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels) Summary: [Constants](https://developer.android.com/reference/android/icu/util/TimeZone#constants) \| [Fields](https://developer.android.com/reference/android/icu/util/TimeZone#lfields) \| [Ctors](https://developer.android.com/reference/android/icu/util/TimeZone#pubctors) \| [Methods](https://developer.android.com/reference/android/icu/util/TimeZone#pubmethods) \| [Inherited Methods](https://developer.android.com/reference/android/icu/util/TimeZone#inhmethods)

# TimeZone

*** ** * ** ***


`
public


abstract
class
TimeZone
`


`

extends https://developer.android.com/reference/java/lang/Object


`

`


implements

https://developer.android.com/reference/java/lang/Cloneable,

https://developer.android.com/reference/android/icu/util/Freezable<https://developer.android.com/reference/android/icu/util/TimeZone>,

https://developer.android.com/reference/java/io/Serializable


`

|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) ||
| ↳ | android.icu.util.TimeZone |

<br />

*** ** * ** ***

**\[icu enhancement\]** ICU's replacement for `https://developer.android.com/reference/java/util/TimeZone`. Methods, fields, and other functionality specific to ICU are labeled '**\[icu\]**'.

`TimeZone` represents a time zone offset, and also computes daylight
savings.

Typically, you get a `TimeZone` using `https://developer.android.com/reference/android/icu/util/TimeZone#getDefault()`
which creates a `TimeZone` based on the time zone where the program
is running. For example, for a program running in Japan, `getDefault`
creates a `TimeZone` object based on Japanese Standard Time.

You can also get a `TimeZone` using `https://developer.android.com/reference/android/icu/util/TimeZone#getTimeZone(java.lang.String)`
along with a time zone ID. For instance, the time zone ID for the
U.S. Pacific Time zone is "America/Los_Angeles". So, you can get a
U.S. Pacific Time `TimeZone` object with:

> ```
> TimeZone tz = TimeZone.getTimeZone("America/Los_Angeles");
> ```
You can use the `https://developer.android.com/reference/android/icu/util/TimeZone#getAvailableIDs()` method to iterate through all the supported time zone IDs, or getCanonicalID method to check if a time zone ID is supported or not. You can then choose a supported ID to get a `TimeZone`. If the time zone you want is not represented by one of the supported IDs, then you can create a custom time zone ID with the following syntax:
>
> ```
> GMT[+|-]hh[[:]mm]
> ```
For example, you might specify GMT+14:00 as a custom time zone ID. The `TimeZone` that is returned when you specify a custom time zone ID uses the specified offset from GMT(=UTC) and does not observe daylight saving time. For example, you might specify GMT+14:00 as a custom time zone ID to create a TimeZone representing 14 hours ahead of GMT (with no daylight saving time). In addition, `getCanonicalID` can also be used to normalize a custom time zone ID.

For compatibility with JDK 1.1.x, some other three-letter time zone IDs
(such as "PST", "CTT", "AST") are also supported. However, **their
use is deprecated** because the same abbreviation is often used
for multiple time zones (for example, "CST" could be U.S. "Central Standard
Time" and "China Standard Time"), and the Java platform can then only
recognize one of them.
**See also:**

- `https://developer.android.com/reference/android/icu/util/Calendar`
- `https://developer.android.com/reference/android/icu/util/GregorianCalendar`

## Summary

| ### Constants ||
|---|---|
| `int` | `https://developer.android.com/reference/android/icu/util/TimeZone#GENERIC_LOCATION` **\[icu\]** A style specifier for `getDisplayName()` indicating a long name derived from the timezone's fallback name, such as "United States (Los Angeles)." |
| `int` | `https://developer.android.com/reference/android/icu/util/TimeZone#LONG` A style specifier for `getDisplayName()` indicating a long name, such as "Pacific Standard Time." |
| `int` | `https://developer.android.com/reference/android/icu/util/TimeZone#LONG_GENERIC` **\[icu\]** A style specifier for `getDisplayName()` indicating a long generic name, such as "Pacific Time." |
| `int` | `https://developer.android.com/reference/android/icu/util/TimeZone#LONG_GMT` **\[icu\]** A style specifier for `getDisplayName()` indicating a long name derived from the timezone's offset, such as "GMT-08:00." |
| `int` | `https://developer.android.com/reference/android/icu/util/TimeZone#SHORT` A style specifier for `getDisplayName()` indicating a short name, such as "PST." |
| `int` | `https://developer.android.com/reference/android/icu/util/TimeZone#SHORT_COMMONLY_USED` **\[icu\]** A style specifier for `getDisplayName()` indicating a short name derived from the timezone's short standard or daylight timezone name ignoring commonlyUsed, such as "PDT." |
| `int` | `https://developer.android.com/reference/android/icu/util/TimeZone#SHORT_GENERIC` **\[icu\]** A style specifier for `getDisplayName()` indicating a short generic name, such as "PT." |
| `int` | `https://developer.android.com/reference/android/icu/util/TimeZone#SHORT_GMT` **\[icu\]** A style specifier for `getDisplayName()` indicating a short name derived from the timezone's offset, such as "-0800." |
| `int` | `https://developer.android.com/reference/android/icu/util/TimeZone#TIMEZONE_ICU` **\[icu\]** A time zone implementation type indicating ICU's own TimeZone used by `getTimeZone`. |
| `int` | `https://developer.android.com/reference/android/icu/util/TimeZone#TIMEZONE_JDK` **\[icu\]** A time zone implementation type indicating the `https://developer.android.com/reference/java/util/TimeZone` used by `getTimeZone`. |
| `https://developer.android.com/reference/java/lang/String` | `https://developer.android.com/reference/android/icu/util/TimeZone#UNKNOWN_ZONE_ID` **\[icu\]** The time zone ID reserved for unknown time zone. |

| ### Fields ||
|---|---|
| ` public static final https://developer.android.com/reference/android/icu/util/TimeZone` | `https://developer.android.com/reference/android/icu/util/TimeZone#GMT_ZONE` **\[icu\]** The immutable GMT (=UTC) time zone. |
| ` public static final https://developer.android.com/reference/android/icu/util/TimeZone` | `https://developer.android.com/reference/android/icu/util/TimeZone#UNKNOWN_ZONE` **\[icu\]** The immutable (frozen) "unknown" time zone. |

| ### Public constructors ||
|---|---|
| ` https://developer.android.com/reference/android/icu/util/TimeZone#TimeZone()() ` Default constructor. |

| ### Public methods ||
|---|---|
| ` https://developer.android.com/reference/java/lang/Object` | ` https://developer.android.com/reference/android/icu/util/TimeZone#clone()() ` Overrides clone. |
| ` https://developer.android.com/reference/android/icu/util/TimeZone` | ` https://developer.android.com/reference/android/icu/util/TimeZone#cloneAsThawed()() ` Provides for the clone operation. |
| ` static int` | ` https://developer.android.com/reference/android/icu/util/TimeZone#countEquivalentIDs(java.lang.String)(https://developer.android.com/reference/java/lang/String id) ` **\[icu\]** Returns the number of IDs in the equivalency group that includes the given ID. |
| ` boolean` | ` https://developer.android.com/reference/android/icu/util/TimeZone#equals(java.lang.Object)(https://developer.android.com/reference/java/lang/Object obj) ` Overrides equals. |
| ` https://developer.android.com/reference/android/icu/util/TimeZone` | ` https://developer.android.com/reference/android/icu/util/TimeZone#freeze()() ` Freezes the object. |
| ` static https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/android/icu/util/TimeZone#getAvailableIDs()() ` Return a new String array containing all system TimeZone IDs. |
| ` static https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/android/icu/util/TimeZone#getAvailableIDs(int)(int rawOffset) ` Return a new String array containing all system TimeZone IDs with the given raw offset from GMT. |
| ` static https://developer.android.com/reference/java/util/Set<https://developer.android.com/reference/java/lang/String>` | ` https://developer.android.com/reference/android/icu/util/TimeZone#getAvailableIDs(android.icu.util.TimeZone.SystemTimeZoneType,%20java.lang.String,%20java.lang.Integer)(https://developer.android.com/reference/android/icu/util/TimeZone.SystemTimeZoneType zoneType, https://developer.android.com/reference/java/lang/String region, https://developer.android.com/reference/java/lang/Integer rawOffset) ` **\[icu\]** Returns a set of time zone ID strings with the given filter conditions. |
| ` static https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/android/icu/util/TimeZone#getAvailableIDs(java.lang.String)(https://developer.android.com/reference/java/lang/String country) ` Return a new String array containing all system TimeZone IDs associated with the given country. |
| ` static https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/android/icu/util/TimeZone#getCanonicalID(java.lang.String)(https://developer.android.com/reference/java/lang/String id) ` **\[icu\]** Returns the canonical system time zone ID or the normalized custom time zone ID for the given time zone ID. |
| ` static https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/android/icu/util/TimeZone#getCanonicalID(java.lang.String,%20boolean[])(https://developer.android.com/reference/java/lang/String id, boolean[] isSystemID) ` **\[icu\]** Returns the canonical system time zone ID or the normalized custom time zone ID for the given time zone ID. |
| ` int` | ` https://developer.android.com/reference/android/icu/util/TimeZone#getDSTSavings()() ` Returns the amount of time to be added to local standard time to get local wall clock time. |
| ` static https://developer.android.com/reference/android/icu/util/TimeZone` | ` https://developer.android.com/reference/android/icu/util/TimeZone#getDefault()() ` Gets the default `TimeZone` for this host. |
| ` https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/android/icu/util/TimeZone#getDisplayName(boolean,%20int,%20java.util.Locale)(boolean daylight, int style, https://developer.android.com/reference/java/util/Locale locale) ` Returns a name of this time zone suitable for presentation to the user in the specified locale. |
| ` final https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/android/icu/util/TimeZone#getDisplayName()() ` Returns a name of this time zone suitable for presentation to the user in the default `DISPLAY` locale. |
| ` final https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/android/icu/util/TimeZone#getDisplayName(android.icu.util.ULocale)(https://developer.android.com/reference/android/icu/util/ULocale locale) ` Returns a name of this time zone suitable for presentation to the user in the specified locale. |
| ` https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/android/icu/util/TimeZone#getDisplayName(boolean,%20int,%20android.icu.util.ULocale)(boolean daylight, int style, https://developer.android.com/reference/android/icu/util/ULocale locale) ` Returns a name of this time zone suitable for presentation to the user in the specified locale. |
| ` final https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/android/icu/util/TimeZone#getDisplayName(java.util.Locale)(https://developer.android.com/reference/java/util/Locale locale) ` Returns a name of this time zone suitable for presentation to the user in the specified locale. |
| ` final https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/android/icu/util/TimeZone#getDisplayName(boolean,%20int)(boolean daylight, int style) ` Returns a name of this time zone suitable for presentation to the user in the default `DISPLAY` locale. |
| ` static https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/android/icu/util/TimeZone#getEquivalentID(java.lang.String,%20int)(https://developer.android.com/reference/java/lang/String id, int index) ` Returns an ID in the equivalency group that includes the given ID. |
| ` static https://developer.android.com/reference/android/icu/util/TimeZone` | ` https://developer.android.com/reference/android/icu/util/TimeZone#getFrozenTimeZone(java.lang.String)(https://developer.android.com/reference/java/lang/String ID) ` Gets the `TimeZone` for the given ID. |
| ` https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/android/icu/util/TimeZone#getID()() ` Gets the ID of this time zone. |
| ` static https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/android/icu/util/TimeZone#getIDForWindowsID(java.lang.String,%20java.lang.String)(https://developer.android.com/reference/java/lang/String winid, https://developer.android.com/reference/java/lang/String region) ` **\[icu\]** Converts a Windows time zone ID to an equivalent system time zone ID for a region. |
| ` static https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/android/icu/util/TimeZone#getIanaID(java.lang.String)(https://developer.android.com/reference/java/lang/String id) ` Returns the preferred time zone ID in the IANA database for the given time zone ID. |
| ` void` | ` https://developer.android.com/reference/android/icu/util/TimeZone#getOffset(long,%20boolean,%20int[])(long date, boolean local, int[] offsets) ` Returns the time zone raw and GMT offset for the given moment in time. |
| ` int` | ` https://developer.android.com/reference/android/icu/util/TimeZone#getOffset(long)(long date) ` Returns the offset of this time zone from UTC at the specified date. |
| ` abstract int` | ` https://developer.android.com/reference/android/icu/util/TimeZone#getOffset(int,%20int,%20int,%20int,%20int,%20int)(int era, int year, int month, int day, int dayOfWeek, int milliseconds) ` Gets the time zone offset, for current date, modified in case of daylight savings. |
| ` abstract int` | ` https://developer.android.com/reference/android/icu/util/TimeZone#getRawOffset()() ` Gets unmodified offset, NOT modified in case of daylight savings. |
| ` static https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/android/icu/util/TimeZone#getRegion(java.lang.String)(https://developer.android.com/reference/java/lang/String id) ` **\[icu\]** Returns the region code associated with the given system time zone ID. |
| ` static https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/android/icu/util/TimeZone#getTZDataVersion()() ` **\[icu\]** Returns the time zone data version currently used by ICU. |
| ` static https://developer.android.com/reference/android/icu/util/TimeZone` | ` https://developer.android.com/reference/android/icu/util/TimeZone#getTimeZone(java.lang.String,%20int)(https://developer.android.com/reference/java/lang/String ID, int type) ` Gets the `TimeZone` for the given ID and the timezone type. |
| ` static https://developer.android.com/reference/android/icu/util/TimeZone` | ` https://developer.android.com/reference/android/icu/util/TimeZone#getTimeZone(java.lang.String)(https://developer.android.com/reference/java/lang/String ID) ` Gets the `TimeZone` for the given ID. |
| ` static https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/android/icu/util/TimeZone#getWindowsID(java.lang.String)(https://developer.android.com/reference/java/lang/String id) ` **\[icu\]** Converts a system time zone ID to an equivalent Windows time zone ID. |
| ` boolean` | ` https://developer.android.com/reference/android/icu/util/TimeZone#hasSameRules(android.icu.util.TimeZone)(https://developer.android.com/reference/android/icu/util/TimeZone other) ` Returns true if this zone has the same rule and offset as another zone. |
| ` int` | ` https://developer.android.com/reference/android/icu/util/TimeZone#hashCode()() ` Overrides hashCode. |
| ` abstract boolean` | ` https://developer.android.com/reference/android/icu/util/TimeZone#inDaylightTime(java.util.Date)(https://developer.android.com/reference/java/util/Date date) ` Queries if the given date is in daylight savings time in this time zone. |
| ` boolean` | ` https://developer.android.com/reference/android/icu/util/TimeZone#isFrozen()() ` Determines whether the object has been frozen or not. |
| ` boolean` | ` https://developer.android.com/reference/android/icu/util/TimeZone#observesDaylightTime()() ` Queries if this time zone is in daylight saving time or will observe daylight saving time at any future time. |
| ` void` | ` https://developer.android.com/reference/android/icu/util/TimeZone#setID(java.lang.String)(https://developer.android.com/reference/java/lang/String ID) ` Sets the time zone ID. |
| ` abstract void` | ` https://developer.android.com/reference/android/icu/util/TimeZone#setRawOffset(int)(int offsetMillis) ` Sets the base time zone offset to GMT. |
| ` abstract boolean` | ` https://developer.android.com/reference/android/icu/util/TimeZone#useDaylightTime()() ` Queries if this time zone uses daylight savings time. |

| ### Inherited methods |
|---|---|
| From class ` https://developer.android.com/reference/java/lang/Object ` |---|---| | ` https://developer.android.com/reference/java/lang/Object` | ` https://developer.android.com/reference/java/lang/Object#clone()() ` Creates and returns a copy of this object. | | ` boolean` | ` https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object)(https://developer.android.com/reference/java/lang/Object obj) ` Indicates whether some other object is "equal to" this one. | | ` void` | ` https://developer.android.com/reference/java/lang/Object#finalize()() ` Called by the garbage collector on an object when garbage collection determines that there are no more references to the object. | | ` final https://developer.android.com/reference/java/lang/Class<?>` | ` https://developer.android.com/reference/java/lang/Object#getClass()() ` Returns the runtime class of this `Object`. | | ` int` | ` https://developer.android.com/reference/java/lang/Object#hashCode()() ` Returns a hash code value for the object. | | ` final void` | ` https://developer.android.com/reference/java/lang/Object#notify()() ` Wakes up a single thread that is waiting on this object's monitor. | | ` final void` | ` https://developer.android.com/reference/java/lang/Object#notifyAll()() ` Wakes up all threads that are waiting on this object's monitor. | | ` https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/java/lang/Object#toString()() ` Returns a string representation of the object. | | ` final void` | ` https://developer.android.com/reference/java/lang/Object#wait(long,%20int)(long timeoutMillis, int nanos) ` Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed. | | ` final void` | ` https://developer.android.com/reference/java/lang/Object#wait(long)(long timeoutMillis) ` Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed. | | ` final void` | ` https://developer.android.com/reference/java/lang/Object#wait()() ` Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*. | ||
| From interface ` https://developer.android.com/reference/android/icu/util/Freezable ` |---|---| | ` abstract https://developer.android.com/reference/android/icu/util/TimeZone` | ` https://developer.android.com/reference/android/icu/util/Freezable#cloneAsThawed()() ` Provides for the clone operation. | | ` abstract https://developer.android.com/reference/android/icu/util/TimeZone` | ` https://developer.android.com/reference/android/icu/util/Freezable#freeze()() ` Freezes the object. | | ` abstract boolean` | ` https://developer.android.com/reference/android/icu/util/Freezable#isFrozen()() ` Determines whether the object has been frozen or not. | ||

## Constants

### GENERIC_LOCATION

Added in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int GENERIC_LOCATION
```

**\[icu\]** A style specifier for `getDisplayName()` indicating
a long name derived from the timezone's fallback name, such as
"United States (Los Angeles)."

<br />

Constant Value:

7
(0x00000007)


### LONG

Added in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int LONG
```

A style specifier for `getDisplayName()` indicating
a long name, such as "Pacific Standard Time."

<br />

**See also:**

- `https://developer.android.com/reference/android/icu/util/TimeZone#SHORT`

Constant Value:

1
(0x00000001)


### LONG_GENERIC

Added in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int LONG_GENERIC
```

**\[icu\]** A style specifier for `getDisplayName()` indicating
a long generic name, such as "Pacific Time."

<br />

**See also:**

- `https://developer.android.com/reference/android/icu/util/TimeZone#SHORT_GENERIC`

Constant Value:

3
(0x00000003)


### LONG_GMT

Added in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int LONG_GMT
```

**\[icu\]** A style specifier for `getDisplayName()` indicating
a long name derived from the timezone's offset, such as "GMT-08:00."

<br />

**See also:**

- `https://developer.android.com/reference/android/icu/util/TimeZone#SHORT_GMT`

Constant Value:

5
(0x00000005)


### SHORT

Added in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int SHORT
```

A style specifier for `getDisplayName()` indicating
a short name, such as "PST."

<br />

**See also:**

- `https://developer.android.com/reference/android/icu/util/TimeZone#LONG`

Constant Value:

0
(0x00000000)


### SHORT_COMMONLY_USED

Added in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int SHORT_COMMONLY_USED
```

**\[icu\]** A style specifier for `getDisplayName()` indicating
a short name derived from the timezone's short standard or daylight
timezone name ignoring commonlyUsed, such as "PDT."

<br />

Constant Value:

6
(0x00000006)


### SHORT_GENERIC

Added in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int SHORT_GENERIC
```

**\[icu\]** A style specifier for `getDisplayName()` indicating
a short generic name, such as "PT."

<br />

**See also:**

- `https://developer.android.com/reference/android/icu/util/TimeZone#LONG_GENERIC`

Constant Value:

2
(0x00000002)


### SHORT_GMT

Added in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int SHORT_GMT
```

**\[icu\]** A style specifier for `getDisplayName()` indicating
a short name derived from the timezone's offset, such as "-0800."

<br />

**See also:**

- `https://developer.android.com/reference/android/icu/util/TimeZone#LONG_GMT`

Constant Value:

4
(0x00000004)


### TIMEZONE_ICU

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int TIMEZONE_ICU
```

**\[icu\]** A time zone implementation type indicating ICU's own TimeZone used by
`getTimeZone`.

<br />

Constant Value:

0
(0x00000000)


### TIMEZONE_JDK

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int TIMEZONE_JDK
```

**\[icu\]** A time zone implementation type indicating the `https://developer.android.com/reference/java/util/TimeZone`
used by `getTimeZone`.

<br />

Constant Value:

1
(0x00000001)


### UNKNOWN_ZONE_ID

Added in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final String UNKNOWN_ZONE_ID
```

**\[icu\]** The time zone ID reserved for unknown time zone.

<br />

**See also:**

- `https://developer.android.com/reference/android/icu/util/TimeZone#getTimeZone(java.lang.String)`

Constant Value:

"Etc/Unknown"


## Fields

### GMT_ZONE

Added in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final TimeZone GMT_ZONE
```

**\[icu\]** The immutable GMT (=UTC) time zone. Its ID is "Etc/GMT".

<br />

### UNKNOWN_ZONE

Added in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final TimeZone UNKNOWN_ZONE
```

**\[icu\]** The immutable (frozen) "unknown" time zone.
It behaves like the GMT/UTC time zone but has the UNKNOWN_ZONE_ID = "Etc/Unknown".
`https://developer.android.com/reference/android/icu/util/TimeZone#getTimeZone(java.lang.String)` returns a mutable clone of this
time zone if the input ID is not recognized.

<br />

**See also:**

- `https://developer.android.com/reference/android/icu/util/TimeZone#UNKNOWN_ZONE_ID`
- `https://developer.android.com/reference/android/icu/util/TimeZone#getTimeZone(java.lang.String)`

## Public constructors

### TimeZone

Added in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public TimeZone ()
```

Default constructor. (For invocation by subclass constructors,
typically implicit.)

<br />

## Public methods

### clone

Added in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public Object clone ()
```

Overrides clone.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/lang/Object` | a clone of this instance. <br /> |

### cloneAsThawed

Added in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public TimeZone cloneAsThawed ()
```

Provides for the clone operation. Any clone is initially unfrozen.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/icu/util/TimeZone` | <br /> |

### countEquivalentIDs

Added in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static int countEquivalentIDs (String id)
```

**\[icu\]** Returns the number of IDs in the equivalency group that
includes the given ID. An equivalency group contains zones
that have the same GMT offset and rules.

The returned count includes the given ID; it is always \>= 1
for valid IDs. The given ID must be a system time zone. If it
is not, returns zero.

<br />

| Parameters ||
|---|---|
| `id` | `String`: a system time zone ID <br /> |

| Returns ||
|---|---|
| `int` | the number of zones in the equivalency group containing 'id', or zero if 'id' is not a valid system ID <br /> |

**See also:**

- `https://developer.android.com/reference/android/icu/util/TimeZone#getEquivalentID(java.lang.String,%20int)`

### equals

Added in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public boolean equals (Object obj)
```

Overrides equals.

<br />

| Parameters ||
|---|---|
| `obj` | `Object`: the reference object with which to compare. <br /> |

| Returns ||
|---|---|
| `boolean` | `true` if this object is the same as the obj argument; `false` otherwise. <br /> |

### freeze

Added in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public TimeZone freeze ()
```

Freezes the object.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/icu/util/TimeZone` | the object itself. <br /> |

### getAvailableIDs

Added in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static String[] getAvailableIDs ()
```

Return a new String array containing all system TimeZone IDs.
These IDs (and only these IDs) may be passed to
`get()` to construct the corresponding TimeZone
object.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/lang/String` | an array of all system TimeZone IDs <br /> |

**See also:**

- `https://developer.android.com/reference/android/icu/util/TimeZone#getAvailableIDs(android.icu.util.TimeZone.SystemTimeZoneType,%20java.lang.String,%20java.lang.Integer)`

### getAvailableIDs

Added in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static String[] getAvailableIDs (int rawOffset)
```

Return a new String array containing all system TimeZone IDs
with the given raw offset from GMT. These IDs may be passed to
`get()` to construct the corresponding TimeZone
object.

<br />

| Parameters ||
|---|---|
| `rawOffset` | `int`: the offset in milliseconds from GMT <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/lang/String` | an array of IDs for system TimeZones with the given raw offset. If there are none, return a zero-length array. <br /> |

**See also:**

- `https://developer.android.com/reference/android/icu/util/TimeZone#getAvailableIDs(android.icu.util.TimeZone.SystemTimeZoneType,%20java.lang.String,%20java.lang.Integer)`

### getAvailableIDs

Added in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static Set<String> getAvailableIDs (TimeZone.SystemTimeZoneType zoneType, 
                String region, 
                Integer rawOffset)
```

**\[icu\]** Returns a set of time zone ID strings with the given filter conditions.

**Note:** A `Set` returned by this method is
immutable.

<br />

| Parameters ||
|---|---|
| `zoneType` | `TimeZone.SystemTimeZoneType`: The system time zone type. <br /> |
| `region` | `String`: The ISO 3166 two-letter country code or UN M.49 three-digit area code. When null, no filtering done by region. <br /> |
| `rawOffset` | `Integer`: An offset from GMT in milliseconds, ignoring the effect of daylight savings time, if any. When null, no filtering done by zone offset. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/util/Set<https://developer.android.com/reference/java/lang/String>` | an immutable set of system time zone IDs. <br /> |

**See also:**

- `https://developer.android.com/reference/android/icu/util/TimeZone.SystemTimeZoneType`

### getAvailableIDs

Added in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static String[] getAvailableIDs (String country)
```

Return a new String array containing all system TimeZone IDs
associated with the given country. These IDs may be passed to
`get()` to construct the corresponding TimeZone
object.

<br />

| Parameters ||
|---|---|
| `country` | `String`: a two-letter ISO 3166 country code, or `null` to return zones not associated with any country <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/lang/String` | an array of IDs for system TimeZones in the given country. If there are none, return a zero-length array. <br /> |

**See also:**

- `https://developer.android.com/reference/android/icu/util/TimeZone#getAvailableIDs(android.icu.util.TimeZone.SystemTimeZoneType,%20java.lang.String,%20java.lang.Integer)`

### getCanonicalID

Added in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static String getCanonicalID (String id)
```

**\[icu\]** Returns the canonical system time zone ID or the normalized
custom time zone ID for the given time zone ID.

<br />

| Parameters ||
|---|---|
| `id` | `String`: The input time zone ID to be canonicalized. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/lang/String` | The canonical system time zone ID or the custom time zone ID in normalized format for the given time zone ID. When the given time zone ID is neither a known system time zone ID nor a valid custom time zone ID, null is returned. <br /> |

### getCanonicalID

Added in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static String getCanonicalID (String id, 
                boolean[] isSystemID)
```

**\[icu\]** Returns the canonical system time zone ID or the normalized
custom time zone ID for the given time zone ID.

<br />

| Parameters ||
|---|---|
| `id` | `String`: The input time zone ID to be canonicalized. <br /> |
| `isSystemID` | `boolean`: When non-null boolean array is specified and the given ID is a known system time zone ID, true is set to `isSystemID[0]` <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/lang/String` | The canonical system time zone ID or the custom time zone ID in normalized format for the given time zone ID. When the given time zone ID is neither a known system time zone ID nor a valid custom time zone ID, null is returned. <br /> |

### getDSTSavings

Added in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public int getDSTSavings ()
```

Returns the amount of time to be added to local standard time
to get local wall clock time.


The default implementation always returns 3600000 milliseconds
(i.e., one hour) if this time zone observes Daylight Saving
Time. Otherwise, 0 (zero) is returned.


If an underlying TimeZone implementation subclass supports
historical Daylight Saving Time changes, this method returns
the known latest daylight saving value.

<br />

| Returns ||
|---|---|
| `int` | the amount of saving time in milliseconds <br /> |

### getDefault

Added in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static TimeZone getDefault ()
```

Gets the default `TimeZone` for this host.
The source of the default `TimeZone`
may vary with implementation.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/icu/util/TimeZone` | a default `TimeZone`. <br /> |

### getDisplayName

Added in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public String getDisplayName (boolean daylight, 
                int style, 
                Locale locale)
```

Returns a name of this time zone suitable for presentation to the user
in the specified locale.
If the display name is not available for the locale,
then this method returns a string in the localized GMT offset format
such as `GMT[+-]HH:mm`.

<br />

| Parameters ||
|---|---|
| `daylight` | `boolean`: if true, return the daylight savings name. <br /> |
| `style` | `int`: the output style of the display name. Valid styles are `SHORT`, `LONG`, `SHORT_GENERIC`, `LONG_GENERIC`, `SHORT_GMT`, `LONG_GMT`, `SHORT_COMMONLY_USED` or `GENERIC_LOCATION`. <br /> |
| `locale` | `Locale`: the locale in which to supply the display name. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/lang/String` | the human-readable name of this time zone in the given locale or in the default locale if the given locale is not recognized. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | style is invalid. |

### getDisplayName

Added in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public final String getDisplayName ()
```

Returns a name of this time zone suitable for presentation to the user
in the default `DISPLAY` locale.
This method returns the long generic name.
If the display name is not available for the locale,
a fallback based on the country, city, or time zone id will be used.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/lang/String` | the human-readable name of this time zone in the default locale. <br /> |

**See also:**

- `https://developer.android.com/reference/android/icu/util/ULocale.Category#DISPLAY`

### getDisplayName

Added in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public final String getDisplayName (ULocale locale)
```

Returns a name of this time zone suitable for presentation to the user
in the specified locale.
This method returns the long name, not including daylight savings.
If the display name is not available for the locale,
a fallback based on the country, city, or time zone id will be used.

<br />

| Parameters ||
|---|---|
| `locale` | `ULocale`: the ulocale in which to supply the display name. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/lang/String` | the human-readable name of this time zone in the given locale or in the default ulocale if the given ulocale is not recognized. <br /> |

### getDisplayName

Added in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public String getDisplayName (boolean daylight, 
                int style, 
                ULocale locale)
```

Returns a name of this time zone suitable for presentation to the user
in the specified locale.
If the display name is not available for the locale,
then this method returns a string in the localized GMT offset format
such as `GMT[+-]HH:mm`.

<br />

| Parameters ||
|---|---|
| `daylight` | `boolean`: if true, return the daylight savings name. <br /> |
| `style` | `int`: the output style of the display name. Valid styles are `SHORT`, `LONG`, `SHORT_GENERIC`, `LONG_GENERIC`, `SHORT_GMT`, `LONG_GMT`, `SHORT_COMMONLY_USED` or `GENERIC_LOCATION`. <br /> |
| `locale` | `ULocale`: the locale in which to supply the display name. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/lang/String` | the human-readable name of this time zone in the given locale or in the default locale if the given locale is not recognized. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | style is invalid. |

### getDisplayName

Added in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public final String getDisplayName (Locale locale)
```

Returns a name of this time zone suitable for presentation to the user
in the specified locale.
This method returns the long generic name.
If the display name is not available for the locale,
a fallback based on the country, city, or time zone id will be used.

<br />

| Parameters ||
|---|---|
| `locale` | `Locale`: the locale in which to supply the display name. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/lang/String` | the human-readable name of this time zone in the given locale or in the default locale if the given locale is not recognized. <br /> |

### getDisplayName

Added in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public final String getDisplayName (boolean daylight, 
                int style)
```

Returns a name of this time zone suitable for presentation to the user
in the default `DISPLAY` locale.
If the display name is not available for the locale,
then this method returns a string in the localized GMT offset format
such as `GMT[+-]HH:mm`.

<br />

| Parameters ||
|---|---|
| `daylight` | `boolean`: if true, return the daylight savings name. <br /> |
| `style` | `int`: the output style of the display name. Valid styles are `SHORT`, `LONG`, `SHORT_GENERIC`, `LONG_GENERIC`, `SHORT_GMT`, `LONG_GMT`, `SHORT_COMMONLY_USED` or `GENERIC_LOCATION`. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/lang/String` | the human-readable name of this time zone in the default locale. <br /> |

**See also:**

- `https://developer.android.com/reference/android/icu/util/ULocale.Category#DISPLAY`

### getEquivalentID

Added in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static String getEquivalentID (String id, 
                int index)
```

Returns an ID in the equivalency group that
includes the given ID. An equivalency group contains zones
that have the same GMT offset and rules.

The given index must be in the range 0..n-1, where n is the
value returned by `countEquivalentIDs(id)`. For
some value of 'index', the returned value will be equal to the
given id. If the given id is not a valid system time zone, or
if 'index' is out of range, then returns an empty string.

<br />

| Parameters ||
|---|---|
| `id` | `String`: a system time zone ID <br /> |
| `index` | `int`: a value from 0 to n-1, where n is the value returned by `countEquivalentIDs(id)` <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/lang/String` | the ID of the index-th zone in the equivalency group containing 'id', or an empty string if 'id' is not a valid system ID or 'index' is out of range <br /> |

**See also:**

- `https://developer.android.com/reference/android/icu/util/TimeZone#countEquivalentIDs(java.lang.String)`

### getFrozenTimeZone

Added in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static TimeZone getFrozenTimeZone (String ID)
```

Gets the `TimeZone` for the given ID. The instance of `TimeZone`
returned by this method is immutable. Any methods mutate the instance(`https://developer.android.com/reference/android/icu/util/TimeZone#setID(java.lang.String)`,
`https://developer.android.com/reference/android/icu/util/TimeZone#setRawOffset(int)`) will throw `UnsupportedOperationException` upon its
invocation.

<br />

| Parameters ||
|---|---|
| `ID` | `String`: the ID for a `TimeZone`, such as "America/Los_Angeles", or a custom ID such as "GMT-8:00". Note that the support of abbreviations, such as "PST", is for JDK 1.1.x compatibility only and full names should be used. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/icu/util/TimeZone` | the specified `TimeZone`, or the UNKNOWN_ZONE if the given ID cannot be understood. <br /> |

**See also:**

- `https://developer.android.com/reference/android/icu/util/TimeZone#UNKNOWN_ZONE`

### getID

Added in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public String getID ()
```

Gets the ID of this time zone.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/lang/String` | the ID of this time zone. <br /> |

### getIDForWindowsID

Added in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static String getIDForWindowsID (String winid, 
                String region)
```

**\[icu\]** Converts a Windows time zone ID to an equivalent system time zone ID
for a region. For example, system time zone ID "America/Los_Angeles" is returned
for input Windows ID "Pacific Standard Time" and region "US" (or `null`),
"America/Vancouver" is returned for the same Windows ID "Pacific Standard Time" and
region "CA".

Not all Windows time zones can be mapped to system time zones. When the input
Windows time zone ID is unknown or unmappable to a system time zone, then this
method returns `null`.

This implementation utilizes [Zone-Tzid mapping data](http://unicode.org/cldr/charts/supplemental/zone_tzid.html). The mapping data is updated time to time. To get the latest changes,
please read the ICU user guide section [Updating the Time Zone Data](https://unicode-org.github.io/icu/userguide/datetime/timezone#updating-the-time-zone-data).

<br />

| Parameters ||
|---|---|
| `winid` | `String`: A Windows time zone ID <br /> |
| `region` | `String`: A region code, or `null` if no regional preference. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/lang/String` | A system time zone ID mapped from the input Windows time zone ID, or `null` when the input ID is unknown or unmappable. <br /> |

**See also:**

- `https://developer.android.com/reference/android/icu/util/TimeZone#getWindowsID(java.lang.String)`

### getIanaID

Added in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static String getIanaID (String id)
```

Returns the preferred time zone ID in the IANA database for the given time zone ID.
There are two types of preferred IDs. The first type is the one defined in zone.tab file,
such as "America/Los_Angeles". The second types is the one defined for zones not associated
with a specific region, but not defined with "Link" syntax, such as "Etc/GMT+10".

Note: For most of system time zone IDs, this method returns an ID same as `https://developer.android.com/reference/android/icu/util/TimeZone#getCanonicalID(java.lang.String)`.
`https://developer.android.com/reference/android/icu/util/TimeZone#getCanonicalID(java.lang.String)` is based on canonical time zone IDs defined in Unicode CLDR.
These canonical time zone IDs in CLDR were based on very old version of the time zone database.
In the IANA time zone database, some IDs were updated since then. This API returns a newer
time zone ID. For example, CLDR defines "Asia/Calcutta" as the canonical time zone ID. This
method returns "Asia/Kolkata" instead.

"Etc/Unknown" is a special time zone ID defined by CLDR. There are no corresponding zones
in the IANA time zone database. when the input is "Etc/Unknown", this method returns "Etc/Unknown",
but it really means no mappings available. Caller of this method should interpret "Etc/Unknown"
as an error.

<br />

| Parameters ||
|---|---|
| `id` | `String`: The input time zone ID. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/lang/String` | The preferred time zone ID in the IANA time zone database, or `https://developer.android.com/reference/android/icu/util/TimeZone#UNKNOWN_ZONE_ID` if the input ID is not a system ID. <br /> |

**See also:**

- `https://developer.android.com/reference/android/icu/util/TimeZone#getCanonicalID(java.lang.String)`

### getOffset

Added in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void getOffset (long date, 
                boolean local, 
                int[] offsets)
```

Returns the time zone raw and GMT offset for the given moment
in time. Upon return, local-millis = GMT-millis + rawOffset +
dstOffset. All computations are performed in the proleptic
Gregorian calendar. The default implementation in the TimeZone
class delegates to the 8-argument getOffset().

<br />

| Parameters ||
|---|---|
| `date` | `long`: moment in time for which to return offsets, in units of milliseconds from January 1, 1970 0:00 GMT, either GMT time or local wall time, depending on `local`. <br /> |
| `local` | `boolean`: if true, `date` is local wall time; otherwise it is in GMT time. <br /> |
| `offsets` | `int`: output parameter to receive the raw offset, that is, the offset not including DST adjustments, in offsets\[0\], and the DST offset, that is, the offset to be added to `rawOffset` to obtain the total offset between local and GMT time, in offsets\[1\]. If DST is not in effect, the DST offset is zero; otherwise it is a positive value, typically one hour. <br /> |

### getOffset

Added in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public int getOffset (long date)
```

Returns the offset of this time zone from UTC at the specified
date. If Daylight Saving Time is in effect at the specified
date, the offset value is adjusted with the amount of daylight
saving.

<br />

| Parameters ||
|---|---|
| `date` | `long`: the date represented in milliseconds since January 1, 1970 00:00:00 GMT <br /> |

| Returns ||
|---|---|
| `int` | the amount of time in milliseconds to add to UTC to get local time. <br /> |

**See also:**

- `https://developer.android.com/reference/android/icu/util/Calendar#ZONE_OFFSET`
- `https://developer.android.com/reference/android/icu/util/Calendar#DST_OFFSET`
- `https://developer.android.com/reference/android/icu/util/TimeZone#getOffset(long,%20boolean,%20int[])`

### getOffset

Added in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public abstract int getOffset (int era, 
                int year, 
                int month, 
                int day, 
                int dayOfWeek, 
                int milliseconds)
```

Gets the time zone offset, for current date, modified in case of
daylight savings. This is the offset to add *to* UTC to get local time.

<br />

| Parameters ||
|---|---|
| `era` | `int`: the era of the given date. <br /> |
| `year` | `int`: the year in the given date. <br /> |
| `month` | `int`: the month in the given date. Month is 0-based. e.g., 0 for January. <br /> |
| `day` | `int`: the day-in-month of the given date. <br /> |
| `dayOfWeek` | `int`: the day-of-week of the given date. <br /> |
| `milliseconds` | `int`: the millis in day in *standard* local time. <br /> |

| Returns ||
|---|---|
| `int` | the offset to add *to* GMT to get local time. <br /> |

### getRawOffset

Added in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public abstract int getRawOffset ()
```

Gets unmodified offset, NOT modified in case of daylight savings.
This is the offset to add *to* UTC to get local time.

<br />

| Returns ||
|---|---|
| `int` | the unmodified offset to add *to* UTC to get local time. <br /> |

### getRegion

Added in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static String getRegion (String id)
```

**\[icu\]** Returns the region code associated with the given
system time zone ID. The region code is either ISO 3166
2-letter country code or UN M.49 3-digit area code.
When the time zone is not associated with a specific location,
for example - "Etc/UTC", "EST5EDT", then this method returns
"001" (UN M.49 area code for World).

<br />

| Parameters ||
|---|---|
| `id` | `String`: the system time zone ID. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/lang/String` | the region code associated with the given system time zone ID. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | if `id` is not a known system ID. |

**See also:**

- `https://developer.android.com/reference/android/icu/util/TimeZone#getAvailableIDs(java.lang.String)`

### getTZDataVersion

Added in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static String getTZDataVersion ()
```

**\[icu\]** Returns the time zone data version currently used by ICU.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/lang/String` | the version string, such as "2007f" <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/util/MissingResourceException` | if ICU time zone resource bundle is missing or the version information is not available. |

### getTimeZone

Added in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static TimeZone getTimeZone (String ID, 
                int type)
```

Gets the `TimeZone` for the given ID and the timezone type.

<br />

| Parameters ||
|---|---|
| `ID` | `String`: the ID for a `TimeZone`, such as "America/Los_Angeles", or a custom ID such as "GMT-8:00". Note that the support of abbreviations, such as "PST", is for JDK 1.1.x compatibility only and full names should be used. <br /> |
| `type` | `int`: Time zone type, either `TIMEZONE_ICU` or `TIMEZONE_JDK`. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/icu/util/TimeZone` | the specified `TimeZone`, or a mutable clone of the UNKNOWN_ZONE if the given ID cannot be understood or if the given ID is "Etc/Unknown". <br /> |

**See also:**

- `https://developer.android.com/reference/android/icu/util/TimeZone#UNKNOWN_ZONE`

### getTimeZone

Added in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static TimeZone getTimeZone (String ID)
```

Gets the `TimeZone` for the given ID.

<br />

| Parameters ||
|---|---|
| `ID` | `String`: the ID for a `TimeZone`, such as "America/Los_Angeles", or a custom ID such as "GMT-8:00". Note that the support of abbreviations, such as "PST", is for JDK 1.1.x compatibility only and full names should be used. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/icu/util/TimeZone` | the specified `TimeZone`, or a mutable clone of the UNKNOWN_ZONE if the given ID cannot be understood or if the given ID is "Etc/Unknown". <br /> |

**See also:**

- `https://developer.android.com/reference/android/icu/util/TimeZone#UNKNOWN_ZONE`

### getWindowsID

Added in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static String getWindowsID (String id)
```

**\[icu\]** Converts a system time zone ID to an equivalent Windows time zone ID. For example,
Windows time zone ID "Pacific Standard Time" is returned for input "America/Los_Angeles".

There are system time zones that cannot be mapped to Windows zones. When the input
system time zone ID is unknown or unmappable to a Windows time zone, then this
method returns `null`.

This implementation utilizes [Zone-Tzid mapping data](http://unicode.org/cldr/charts/supplemental/zone_tzid.html). The mapping data is updated time to time. To get the latest changes,
please read the ICU user guide section [Updating the Time Zone Data](https://unicode-org.github.io/icu/userguide/datetime/timezone#updating-the-time-zone-data).

<br />

| Parameters ||
|---|---|
| `id` | `String`: A system time zone ID <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/lang/String` | A Windows time zone ID mapped from the input system time zone ID, or `null` when the input ID is unknown or unmappable. <br /> |

**See also:**

- `https://developer.android.com/reference/android/icu/util/TimeZone#getIDForWindowsID(java.lang.String,%20java.lang.String)`

### hasSameRules

Added in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public boolean hasSameRules (TimeZone other)
```

Returns true if this zone has the same rule and offset as another zone.
That is, if this zone differs only in ID, if at all. Returns false
if the other zone is null.

<br />

| Parameters ||
|---|---|
| `other` | `TimeZone`: the `TimeZone` object to be compared with <br /> |

| Returns ||
|---|---|
| `boolean` | true if the other zone is not null and is the same as this one, with the possible exception of the ID <br /> |

### hashCode

Added in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public int hashCode ()
```

Overrides hashCode.

<br />

| Returns ||
|---|---|
| `int` | a hash code value for this object. <br /> |

### inDaylightTime

Added in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public abstract boolean inDaylightTime (Date date)
```

Queries if the given date is in daylight savings time in
this time zone.

<br />

| Parameters ||
|---|---|
| `date` | `Date`: the given Date. <br /> |

| Returns ||
|---|---|
| `boolean` | true if the given date is in daylight savings time, false, otherwise. <br /> |

### isFrozen

Added in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public boolean isFrozen ()
```

Determines whether the object has been frozen or not.

<br />

| Returns ||
|---|---|
| `boolean` | <br /> |

### observesDaylightTime

Added in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public boolean observesDaylightTime ()
```

Queries if this time zone is in daylight saving time or will observe
daylight saving time at any future time.

The default implementation in this class returns `true` if `https://developer.android.com/reference/android/icu/util/TimeZone#useDaylightTime()`
or `https://developer.android.com/reference/android/icu/util/TimeZone#inDaylightTime(java.util.Date)` returns `true`.


**Note:** This method was added for `https://developer.android.com/reference/java/util/TimeZone` compatibility
support. The `https://developer.android.com/reference/java/util/TimeZone#useDaylightTime()` method only checks the last known
rule(s), therefore it may return false even the zone observes daylight saving time currently.
`https://developer.android.com/reference/java/util/TimeZone` added `observesDaylightTime()` to resolve the issue.
In ICU, `https://developer.android.com/reference/android/icu/util/TimeZone#useDaylightTime()` works differently. The ICU implementation checks if the
zone uses daylight saving time in the current calendar year. Therefore, it will never return
`false` if daylight saving time is currently used.


ICU's TimeZone subclass implementations override this method to support the same behavior
with `https://developer.android.com/reference/java/util/TimeZone#observesDaylightTime()`. Unlike `https://developer.android.com/reference/android/icu/util/TimeZone#useDaylightTime()`,
the implementation does not take past daylight saving time into account, so
that this method may return `false` even when `https://developer.android.com/reference/android/icu/util/TimeZone#useDaylightTime()` returns
`true`.

<br />

| Returns ||
|---|---|
| `boolean` | `true` if this time zone is in daylight saving time or will observe daylight saving time at any future time. <br /> |

**See also:**

- `https://developer.android.com/reference/android/icu/util/TimeZone#useDaylightTime()`

### setID

Added in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void setID (String ID)
```

Sets the time zone ID. This does not change any other data in
the time zone object.

<br />

| Parameters ||
|---|---|
| `ID` | `String`: the new time zone ID. <br /> |

### setRawOffset

Added in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public abstract void setRawOffset (int offsetMillis)
```

Sets the base time zone offset to GMT.
This is the offset to add *to* UTC to get local time.

<br />

| Parameters ||
|---|---|
| `offsetMillis` | `int`: the given base time zone offset to GMT. <br /> |

### useDaylightTime

Added in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public abstract boolean useDaylightTime ()
```

Queries if this time zone uses daylight savings time.

<br />

| Returns ||
|---|---|
| `boolean` | true if this time zone uses daylight savings time, false, otherwise. **Note:** The default implementation of ICU TimeZone uses the tz database, which supports historic rule changes, for system time zones. With the implementation, there are time zones that used daylight savings time in the past, but no longer used currently. For example, Asia/Tokyo has never used daylight savings time since 1951. Most clients would expect that this method to return `false` for such case. The default implementation of this method returns `true` when the time zone uses daylight savings time in the current (Gregorian) calendar year. |