Udostępnij za pośrednictwem


TimeZone.GetTimeZone Method

Definition

Overloads

GetTimeZone(String)

Gets the TimeZone for the given ID.

GetTimeZone(ZoneId)

Gets the TimeZone for the given zoneId.

GetTimeZone(String)

Gets the TimeZone for the given ID.

[Android.Runtime.Register("getTimeZone", "(Ljava/lang/String;)Ljava/util/TimeZone;", "")]
public static Java.Util.TimeZone? GetTimeZone (string? id);
[<Android.Runtime.Register("getTimeZone", "(Ljava/lang/String;)Ljava/util/TimeZone;", "")>]
static member GetTimeZone : string -> Java.Util.TimeZone

Parameters

id
String

the ID for a TimeZone, either an abbreviation such as "PST", a full name such as "America/Los_Angeles", or a custom ID such as "GMT-8:00". Note that the support of abbreviations is for JDK 1.1.x compatibility only and full names should be used.

Returns

the specified TimeZone, or the GMT zone if the given ID cannot be understood.

Attributes

Remarks

Gets the TimeZone for the given ID.

Java documentation for java.util.TimeZone.getTimeZone(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.

Applies to

GetTimeZone(ZoneId)

Gets the TimeZone for the given zoneId.

[Android.Runtime.Register("getTimeZone", "(Ljava/time/ZoneId;)Ljava/util/TimeZone;", "", ApiSince=26)]
public static Java.Util.TimeZone? GetTimeZone (Java.Time.ZoneId? zoneId);
[<Android.Runtime.Register("getTimeZone", "(Ljava/time/ZoneId;)Ljava/util/TimeZone;", "", ApiSince=26)>]
static member GetTimeZone : Java.Time.ZoneId -> Java.Util.TimeZone

Parameters

zoneId
ZoneId

a ZoneId from which the time zone ID is obtained

Returns

the specified TimeZone, or the GMT zone if the given ID cannot be understood.

Attributes

Remarks

Gets the TimeZone for the given zoneId.

Added in 1.8.

Java documentation for java.util.TimeZone.getTimeZone(java.time.ZoneId).

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.

Applies to