TimeZone.GetIanaID(String) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Returns the preferred time zone ID in the IANA database for the given time zone ID.
[Android.Runtime.Register("getIanaID", "(Ljava/lang/String;)Ljava/lang/String;", "", ApiSince=36)]
public static string? GetIanaID(string? id);
[<Android.Runtime.Register("getIanaID", "(Ljava/lang/String;)Ljava/lang/String;", "", ApiSince=36)>]
static member GetIanaID : string -> string
Parameters
- id
- String
The input time zone ID.
Returns
The preferred time zone ID in the IANA time zone database, or TimeZone#UNKNOWN_ZONE_ID
if the input ID is not a system ID.
- Attributes
Remarks
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 TimeZone#getCanonicalID(String)
. TimeZone#getCanonicalID(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.
Java documentation for android.icu.util.TimeZone.getIanaID(java.lang.String)
.
Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.