Added in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels) Summary: [Methods](https://developer.android.com/reference/android/icu/text/TimeZoneNames#pubmethods) \| [Inherited Methods](https://developer.android.com/reference/android/icu/text/TimeZoneNames#inhmethods)

# TimeZoneNames

*** ** * ** ***


`
public


abstract
class
TimeZoneNames
`


`

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


`

`


implements

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


`

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

<br />

*** ** * ** ***

`TimeZoneNames` is an abstract class representing the time zone display name data model defined
by [UTS#35 Unicode Locale Data Markup Language (LDML)](http://www.unicode.org/reports/tr35/).
The model defines meta zone, which is used for storing a set of display names. A meta zone can be shared
by multiple time zones. Also a time zone may have multiple meta zone historic mappings.


For example, people in the United States refer the zone used by the east part of North America as "Eastern Time".
The tz database contains multiple time zones "America/New_York", "America/Detroit", "America/Montreal" and some
others that belong to "Eastern Time". However, assigning different display names to these time zones does not make
much sense for most of people.


In [CLDR](http://cldr.unicode.org/) (which uses LDML for representing locale data), the display name
"Eastern Time" is stored as long generic display name of a meta zone identified by the ID "America_Eastern".
Then, there is another table maintaining the historic mapping to meta zones for each time zone. The time zones in
the above example ("America/New_York", "America/Detroit"...) are mapped to the meta zone "America_Eastern".


Sometimes, a time zone is mapped to a different time zone in the past. For example, "America/Indiana/Knox"
had been moving "Eastern Time" and "Central Time" back and forth. Therefore, it is necessary that time zone
to meta zones mapping data are stored by date range.

**Note:**


`https://developer.android.com/reference/android/icu/text/TimeZoneFormat` assumes an instance of `TimeZoneNames` is immutable. If you want to provide
your own `TimeZoneNames` implementation and use it with `https://developer.android.com/reference/android/icu/text/TimeZoneFormat`, you must follow
the contract.


The methods in this class assume that time zone IDs are already canonicalized. For example, you may not get proper
result returned by a method with time zone ID "America/Indiana/Indianapolis", because it's not a canonical time zone
ID (the canonical time zone ID for the time zone is "America/Indianapolis". See
`https://developer.android.com/reference/android/icu/util/TimeZone#getCanonicalID(java.lang.String)` about ICU canonical time zone IDs.


In CLDR, most of time zone display names except location names are provided through meta zones. But a time zone may
have a specific name that is not shared with other time zones.

For example, time zone "Europe/London" has English long name for standard time "Greenwich Mean Time", which is also
shared with other time zones. However, the long name for daylight saving time is "British Summer Time", which is only
used for "Europe/London".


`https://developer.android.com/reference/android/icu/text/TimeZoneNames#getTimeZoneDisplayName(java.lang.String,%20android.icu.text.TimeZoneNames.NameType)` is designed for accessing a name only used by a single time zone.
But is not necessarily mean that a subclass implementation use the same model with CLDR. A subclass implementation
may provide time zone names only through `https://developer.android.com/reference/android/icu/text/TimeZoneNames#getTimeZoneDisplayName(java.lang.String,%20android.icu.text.TimeZoneNames.NameType)`, or only through
`https://developer.android.com/reference/android/icu/text/TimeZoneNames#getMetaZoneDisplayName(java.lang.String,%20android.icu.text.TimeZoneNames.NameType)`, or both.


The default `TimeZoneNames` implementation returned by `https://developer.android.com/reference/android/icu/text/TimeZoneNames#getInstance(android.icu.util.ULocale)` uses the locale data
imported from CLDR. In CLDR, set of meta zone IDs and mappings between zone IDs and meta zone IDs are shared by all
locales. Therefore, the behavior of `https://developer.android.com/reference/android/icu/text/TimeZoneNames#getAvailableMetaZoneIDs()`, `https://developer.android.com/reference/android/icu/text/TimeZoneNames#getAvailableMetaZoneIDs(java.lang.String)`,
`https://developer.android.com/reference/android/icu/text/TimeZoneNames#getMetaZoneID(java.lang.String,%20long)`, and `https://developer.android.com/reference/android/icu/text/TimeZoneNames#getReferenceZoneID(java.lang.String,%20java.lang.String)` won't be changed no matter
what locale is used for getting an instance of `TimeZoneNames`.

## Summary

| ### Public methods ||
|---|---|
| ` abstract https://developer.android.com/reference/java/util/Set<https://developer.android.com/reference/java/lang/String>` | ` https://developer.android.com/reference/android/icu/text/TimeZoneNames#getAvailableMetaZoneIDs()() ` Returns an immutable set of all available meta zone IDs. |
| ` abstract https://developer.android.com/reference/java/util/Set<https://developer.android.com/reference/java/lang/String>` | ` https://developer.android.com/reference/android/icu/text/TimeZoneNames#getAvailableMetaZoneIDs(java.lang.String)(https://developer.android.com/reference/java/lang/String tzID) ` Returns an immutable set of all available meta zone IDs used by the given time zone. |
| ` final https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/android/icu/text/TimeZoneNames#getDisplayName(java.lang.String,%20android.icu.text.TimeZoneNames.NameType,%20long)(https://developer.android.com/reference/java/lang/String tzID, https://developer.android.com/reference/android/icu/text/TimeZoneNames.NameType type, long date) ` Returns the display name of the time zone at the given date. |
| ` https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/android/icu/text/TimeZoneNames#getExemplarLocationName(java.lang.String)(https://developer.android.com/reference/java/lang/String tzID) ` Returns the exemplar location name for the given time zone. |
| ` static https://developer.android.com/reference/android/icu/text/TimeZoneNames` | ` https://developer.android.com/reference/android/icu/text/TimeZoneNames#getInstance(android.icu.util.ULocale)(https://developer.android.com/reference/android/icu/util/ULocale locale) ` Returns an instance of `TimeZoneNames` for the specified locale. |
| ` static https://developer.android.com/reference/android/icu/text/TimeZoneNames` | ` https://developer.android.com/reference/android/icu/text/TimeZoneNames#getInstance(java.util.Locale)(https://developer.android.com/reference/java/util/Locale locale) ` Returns an instance of `TimeZoneNames` for the specified `https://developer.android.com/reference/java/util/Locale`. |
| ` abstract https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/android/icu/text/TimeZoneNames#getMetaZoneDisplayName(java.lang.String,%20android.icu.text.TimeZoneNames.NameType)(https://developer.android.com/reference/java/lang/String mzID, https://developer.android.com/reference/android/icu/text/TimeZoneNames.NameType type) ` Returns the display name of the meta zone. |
| ` abstract https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/android/icu/text/TimeZoneNames#getMetaZoneID(java.lang.String,%20long)(https://developer.android.com/reference/java/lang/String tzID, long date) ` Returns the meta zone ID for the given canonical time zone ID at the given date. |
| ` abstract https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/android/icu/text/TimeZoneNames#getReferenceZoneID(java.lang.String,%20java.lang.String)(https://developer.android.com/reference/java/lang/String mzID, https://developer.android.com/reference/java/lang/String region) ` Returns the reference zone ID for the given meta zone ID for the region. |
| ` static https://developer.android.com/reference/android/icu/text/TimeZoneNames` | ` https://developer.android.com/reference/android/icu/text/TimeZoneNames#getTZDBInstance(android.icu.util.ULocale)(https://developer.android.com/reference/android/icu/util/ULocale locale) ` Returns an instance of `TimeZoneNames` containing only short specific zone names (`https://developer.android.com/reference/android/icu/text/TimeZoneNames.NameType#SHORT_STANDARD` and `https://developer.android.com/reference/android/icu/text/TimeZoneNames.NameType#SHORT_DAYLIGHT`), compatible with the IANA tz database's zone abbreviations (not localized). |
| ` abstract https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/android/icu/text/TimeZoneNames#getTimeZoneDisplayName(java.lang.String,%20android.icu.text.TimeZoneNames.NameType)(https://developer.android.com/reference/java/lang/String tzID, https://developer.android.com/reference/android/icu/text/TimeZoneNames.NameType type) ` Returns the display name of the time zone. |

| ### 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*. | ||

## Public methods

### getAvailableMetaZoneIDs

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

```
public abstract Set<String> getAvailableMetaZoneIDs ()
```

Returns an immutable set of all available meta zone IDs.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/util/Set<https://developer.android.com/reference/java/lang/String>` | An immutable set of all available meta zone IDs. <br /> |

### getAvailableMetaZoneIDs

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

```
public abstract Set<String> getAvailableMetaZoneIDs (String tzID)
```

Returns an immutable set of all available meta zone IDs used by the given time zone.

<br />

| Parameters ||
|---|---|
| `tzID` | `String`: The canonical time zone ID. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/util/Set<https://developer.android.com/reference/java/lang/String>` | An immutable set of all available meta zone IDs used by the given time zone. <br /> |

### getDisplayName

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

```
public final String getDisplayName (String tzID, 
                TimeZoneNames.NameType type, 
                long date)
```

Returns the display name of the time zone at the given date.


**Note:** This method calls the subclass's `https://developer.android.com/reference/android/icu/text/TimeZoneNames#getTimeZoneDisplayName(java.lang.String,%20android.icu.text.TimeZoneNames.NameType)` first. When the
result is null, this method calls `https://developer.android.com/reference/android/icu/text/TimeZoneNames#getMetaZoneID(java.lang.String,%20long)` to get the meta zone ID mapped from the
time zone, then calls `https://developer.android.com/reference/android/icu/text/TimeZoneNames#getMetaZoneDisplayName(java.lang.String,%20android.icu.text.TimeZoneNames.NameType)`.

<br />

| Parameters ||
|---|---|
| `tzID` | `String`: The canonical time zone ID. <br /> |
| `type` | `TimeZoneNames.NameType`: The display name type. See `https://developer.android.com/reference/android/icu/text/TimeZoneNames.NameType`. <br /> |
| `date` | `long`: The date <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/lang/String` | The display name for the time zone at the given date. When this object does not have a localized display name for the time zone with the specified type and date, null is returned. <br /> |

### getExemplarLocationName

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

```
public String getExemplarLocationName (String tzID)
```

Returns the exemplar location name for the given time zone. When this object does not have a localized location
name, the default implementation may still returns a programmatically generated name with the logic described
below.

1. Check if the ID contains "/". If not, return null.
2. Check if the ID does not start with "Etc/" or "SystemV/". If it does, return null.
3. Extract a substring after the last occurrence of "/".
4. Replace "_" with " ".

For example, "New York" is returned for the time zone ID "America/New_York" when this object does not have the localized location name.

<br />

<br />

| Parameters ||
|---|---|
| `tzID` | `String`: The canonical time zone ID <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/lang/String` | The exemplar location name for the given time zone, or null when a localized location name is not available and the fallback logic described above cannot extract location from the ID. <br /> |

### getInstance

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

```
public static TimeZoneNames getInstance (ULocale locale)
```

Returns an instance of `TimeZoneNames` for the specified locale.

<br />

| Parameters ||
|---|---|
| `locale` | `ULocale`: The locale. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/icu/text/TimeZoneNames` | An instance of `TimeZoneNames` <br /> |

### getInstance

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

```
public static TimeZoneNames getInstance (Locale locale)
```

Returns an instance of `TimeZoneNames` for the specified
`https://developer.android.com/reference/java/util/Locale`.

<br />

| Parameters ||
|---|---|
| `locale` | `Locale`: The `https://developer.android.com/reference/java/util/Locale`. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/icu/text/TimeZoneNames` | An instance of `TimeZoneDisplayNames` <br /> |

### getMetaZoneDisplayName

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

```
public abstract String getMetaZoneDisplayName (String mzID, 
                TimeZoneNames.NameType type)
```

Returns the display name of the meta zone.

<br />

| Parameters ||
|---|---|
| `mzID` | `String`: The meta zone ID. <br /> |
| `type` | `TimeZoneNames.NameType`: The display name type. See `https://developer.android.com/reference/android/icu/text/TimeZoneNames.NameType`. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/lang/String` | The display name of the meta zone. When this object does not have a localized display name for the given meta zone with the specified type or the implementation does not provide any display names associated with meta zones, null is returned. <br /> |

### getMetaZoneID

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

```
public abstract String getMetaZoneID (String tzID, 
                long date)
```

Returns the meta zone ID for the given canonical time zone ID at the given date.

<br />

| Parameters ||
|---|---|
| `tzID` | `String`: The canonical time zone ID. <br /> |
| `date` | `long`: The date. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/lang/String` | The meta zone ID for the given time zone ID at the given date. If the time zone does not have a corresponding meta zone at the given date or the implementation does not support meta zones, null is returned. <br /> |

### getReferenceZoneID

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

```
public abstract String getReferenceZoneID (String mzID, 
                String region)
```

Returns the reference zone ID for the given meta zone ID for the region.

Note: Each meta zone must have a reference zone associated with a special region "001" (world).
Some meta zones may have region specific reference zone IDs other than the special region
"001". When a meta zone does not have any region specific reference zone IDs, this method
return the reference zone ID for the special region "001" (world).

<br />

| Parameters ||
|---|---|
| `mzID` | `String`: The meta zone ID. <br /> |
| `region` | `String`: The region. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/lang/String` | The reference zone ID ("golden zone" in the LDML specification) for the given time zone ID for the region. If the meta zone is unknown or the implementation does not support meta zones, null is returned. <br /> |

### getTZDBInstance

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

```
public static TimeZoneNames getTZDBInstance (ULocale locale)
```

Returns an instance of `TimeZoneNames` containing only short specific
zone names (`https://developer.android.com/reference/android/icu/text/TimeZoneNames.NameType#SHORT_STANDARD` and `https://developer.android.com/reference/android/icu/text/TimeZoneNames.NameType#SHORT_DAYLIGHT`),
compatible with the IANA tz database's zone abbreviations (not localized).


Note: The input locale is used for resolving ambiguous names (e.g. "IST" is parsed
as Israel Standard Time for Israel, while it is parsed as India Standard Time for
all other regions). The zone names returned by this instance are not localized.

<br />

| Parameters ||
|---|---|
| `locale` | `ULocale` <br /> |

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

### getTimeZoneDisplayName

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

```
public abstract String getTimeZoneDisplayName (String tzID, 
                TimeZoneNames.NameType type)
```

Returns the display name of the time zone. Unlike `https://developer.android.com/reference/android/icu/text/TimeZoneNames#getDisplayName(java.lang.String,%20android.icu.text.TimeZoneNames.NameType,%20long)`,
this method does not get a name from a meta zone used by the time zone.

<br />

| Parameters ||
|---|---|
| `tzID` | `String`: The canonical time zone ID. <br /> |
| `type` | `TimeZoneNames.NameType`: The display name type. See `https://developer.android.com/reference/android/icu/text/TimeZoneNames.NameType`. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/lang/String` | The display name for the time zone. When this object does not have a localized display name for the given time zone with the specified type, null is returned. <br /> |