TimeZone Class
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.
<strong>[icu enhancement]</strong> ICU's replacement for java.util.TimeZone
.
[Android.Runtime.Register("android/icu/util/TimeZone", ApiSince=24, DoNotGenerateAcw=true)]
public abstract class TimeZone : Java.Lang.Object, Android.Icu.Util.IFreezable, IDisposable, Java.Interop.IJavaPeerable, Java.IO.ISerializable
[<Android.Runtime.Register("android/icu/util/TimeZone", ApiSince=24, DoNotGenerateAcw=true)>]
type TimeZone = class
inherit Object
interface IFreezable
interface ICloneable
interface IJavaObject
interface IDisposable
interface IJavaPeerable
interface ISerializable
- Inheritance
- Attributes
- Implements
Remarks
<strong>[icu enhancement]</strong> ICU's replacement for java.util.TimeZone
. Methods, fields, and other functionality specific to ICU are labeled '<strong>[icu]</strong>'.
TimeZone
represents a time zone offset, and also computes daylight savings.
Typically, you get a TimeZone
using #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 #getTimeZone(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:
<blockquote>
TimeZone tz = TimeZone.getTimeZone("America/Los_Angeles");
</blockquote> You can use the #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:
<blockquote>
GMT[+|-]hh[[:]mm]
</blockquote>
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, <strong>their use is deprecated</strong> 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.
Java documentation for android.icu.util.TimeZone
.
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.
Constructors
TimeZone() |
Default constructor. |
TimeZone(IntPtr, JniHandleOwnership) |
Fields
GenericLocation |
Obsolete.
<strong>[icu]</strong> A style specifier for |
Long |
Obsolete.
A style specifier for |
LongGeneric |
Obsolete.
<strong>[icu]</strong> A style specifier for |
LongGmt |
Obsolete.
<strong>[icu]</strong> A style specifier for |
Short |
Obsolete.
A style specifier for |
ShortCommonlyUsed |
Obsolete.
<strong>[icu]</strong> A style specifier for |
ShortGeneric |
Obsolete.
<strong>[icu]</strong> A style specifier for |
ShortGmt |
Obsolete.
<strong>[icu]</strong> A style specifier for |
TimezoneIcu |
Obsolete.
<strong>[icu]</strong> A time zone implementation type indicating ICU's own TimeZone used by
|
TimezoneJdk |
Obsolete.
<strong>[icu]</strong> A time zone implementation type indicating the |
UnknownZoneId |
<strong>[icu]</strong> The time zone ID reserved for unknown time zone. |
Properties
Class |
Returns the runtime class of this |
Default |
Gets the default |
DisplayName |
Returns a name of this time zone suitable for presentation to the user
in the default |
DSTSavings |
Returns the amount of time to be added to local standard time to get local wall clock time. |
GmtZone |
<strong>[icu]</strong> The immutable GMT (=UTC) time zone. |
Handle |
The handle to the underlying Android instance. (Inherited from Object) |
ID |
Gets the ID of this time zone. -or- Sets the time zone ID. |
IsFrozen |
To be added |
JniIdentityHashCode | (Inherited from Object) |
JniPeerMembers | |
PeerReference | (Inherited from Object) |
RawOffset | |
ThresholdClass | |
ThresholdType | |
TZDataVersion |
<strong>[icu]</strong> Returns the time zone data version currently used by ICU. |
UnknownZone |
<strong>[icu]</strong> The immutable (frozen) "unknown" time zone. |
Methods
Clone() |
Overrides clone. |
CloneAsThawed() |
To be added |
CountEquivalentIDs(String) |
<strong>[icu]</strong> Returns the number of IDs in the equivalency group that includes the given ID. |
Dispose() | (Inherited from Object) |
Dispose(Boolean) | (Inherited from Object) |
Equals(Object) |
Indicates whether some other object is "equal to" this one. (Inherited from Object) |
Freeze() |
To be added |
GetAvailableIDs() |
Return a new String array containing all system TimeZone IDs. |
GetAvailableIDs(Int32) |
Return a new String array containing all system TimeZone IDs with the given raw offset from GMT. |
GetAvailableIDs(String) |
Return a new String array containing all system TimeZone IDs associated with the given country. |
GetAvailableIDs(TimeZone+SystemTimeZoneType, String, Integer) | |
GetCanonicalID(String, Boolean[]) |
<strong>[icu]</strong> Returns the canonical system time zone ID or the normalized custom time zone ID for the given time zone ID. |
GetCanonicalID(String) |
<strong>[icu]</strong> Returns the canonical system time zone ID or the normalized custom time zone ID for the given time zone ID. |
GetDisplayName(Boolean, TimeZoneNameStyle, Locale) |
Returns a name of this time zone suitable for presentation to the user in the specified locale. |
GetDisplayName(Boolean, TimeZoneNameStyle, ULocale) |
Returns a name of this time zone suitable for presentation to the user in the specified locale. |
GetDisplayName(Boolean, TimeZoneNameStyle) |
Returns a name of this time zone suitable for presentation to the user
in the default |
GetDisplayName(Locale) |
Returns a name of this time zone suitable for presentation to the user in the specified locale. |
GetDisplayName(ULocale) |
Returns a name of this time zone suitable for presentation to the user in the specified locale. |
GetEquivalentID(String, Int32) |
Returns an ID in the equivalency group that includes the given ID. |
GetFrozenTimeZone(String) |
Gets the |
GetHashCode() |
Returns a hash code value for the object. (Inherited from Object) |
GetIDForWindowsID(String, String) |
<strong>[icu]</strong> Converts a Windows time zone ID to an equivalent system time zone ID for a region. |
GetOffset(Int32, Int32, Int32, Int32, Int32, Int32) |
Gets the time zone offset, for current date, modified in case of daylight savings. |
GetOffset(Int64, Boolean, Int32[]) |
Returns the time zone raw and GMT offset for the given moment in time. |
GetOffset(Int64) |
Returns the offset of this time zone from UTC at the specified date. |
GetRegion(String) |
<strong>[icu]</strong> Returns the region code associated with the given system time zone ID. |
GetTimeZone(String, TimeZoneType) |
Gets the |
GetTimeZone(String) |
Gets the |
GetWindowsID(String) |
<strong>[icu]</strong> Converts a system time zone ID to an equivalent Windows time zone ID. |
HasSameRules(TimeZone) |
Returns true if this zone has the same rule and offset as another zone. |
InDaylightTime(Date) |
Queries if the given date is in daylight savings time in this time zone. |
JavaFinalize() |
Called by the garbage collector on an object when garbage collection determines that there are no more references to the object. (Inherited from Object) |
Notify() |
Wakes up a single thread that is waiting on this object's monitor. (Inherited from Object) |
NotifyAll() |
Wakes up all threads that are waiting on this object's monitor. (Inherited from Object) |
ObservesDaylightTime() |
Queries if this time zone is in daylight saving time or will observe daylight saving time at any future time. |
SetHandle(IntPtr, JniHandleOwnership) |
Sets the Handle property. (Inherited from Object) |
ToArray<T>() | (Inherited from Object) |
ToString() |
Returns a string representation of the object. (Inherited from Object) |
UnregisterFromRuntime() | (Inherited from Object) |
UseDaylightTime() |
Queries if this time zone uses daylight savings time. |
Wait() |
Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>. (Inherited from Object) |
Wait(Int64, Int32) |
Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed. (Inherited from Object) |
Wait(Int64) |
Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed. (Inherited from Object) |
Explicit Interface Implementations
IFreezable.CloneAsThawed() | |
IFreezable.Freeze() | |
IJavaPeerable.Disposed() | (Inherited from Object) |
IJavaPeerable.DisposeUnlessReferenced() | (Inherited from Object) |
IJavaPeerable.Finalized() | (Inherited from Object) |
IJavaPeerable.JniManagedPeerState | (Inherited from Object) |
IJavaPeerable.SetJniIdentityHashCode(Int32) | (Inherited from Object) |
IJavaPeerable.SetJniManagedPeerState(JniManagedPeerStates) | (Inherited from Object) |
IJavaPeerable.SetPeerReference(JniObjectReference) | (Inherited from Object) |
Extension Methods
JavaCast<TResult>(IJavaObject) |
Performs an Android runtime-checked type conversion. |
JavaCast<TResult>(IJavaObject) | |
GetJniTypeName(IJavaPeerable) |
Gets the JNI name of the type of the instance |
JavaAs<TResult>(IJavaPeerable) |
Try to coerce |
TryJavaCast<TResult>(IJavaPeerable, TResult) |
Try to coerce |