ZoneId.Of Method

Definition

Overloads

Name Description
Of(String)

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

Of(String, IDictionary<String,String>)

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

Of(String)

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

[Android.Runtime.Register("of", "(Ljava/lang/String;)Ljava/time/ZoneId;", "", ApiSince=26)]
public static Java.Time.ZoneId? Of(string? zoneId);
[<Android.Runtime.Register("of", "(Ljava/lang/String;)Ljava/time/ZoneId;", "", ApiSince=26)>]
static member Of : string -> Java.Time.ZoneId

Parameters

zoneId
String

the time-zone ID, not null

Returns

the zone ID, not null

Attributes

Remarks

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 ZoneRules 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 ZoneOffset.of(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 ZoneOffset. The result will be a ZoneId with the specified UTC/GMT/UT prefix and the normalized offset ID as per ZoneOffset.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 TimeZone.

Java reference for java.time.ZoneId.of.

Applies to

Of(String, IDictionary<String,String>)

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

[Android.Runtime.Register("of", "(Ljava/lang/String;Ljava/util/Map;)Ljava/time/ZoneId;", "", ApiSince=26)]
public static Java.Time.ZoneId? Of(string? zoneId, System.Collections.Generic.IDictionary<string,string>? aliasMap);
[<Android.Runtime.Register("of", "(Ljava/lang/String;Ljava/util/Map;)Ljava/time/ZoneId;", "", ApiSince=26)>]
static member Of : string * System.Collections.Generic.IDictionary<string, string> -> Java.Time.ZoneId

Parameters

zoneId
String

the time-zone ID, not null

aliasMap
IDictionary<String,String>

a map of alias zone IDs (typically abbreviations) to real zone IDs, not null

Returns

the zone ID, not null

Attributes

Remarks

To be added.

Java reference for java.time.ZoneId.of.

Applies to