다음을 통해 공유


Date.TimezoneOffset Property

Definition

Caution

deprecated

Returns the offset, measured in minutes, for the local time zone relative to UTC that is appropriate for the time represented by this Date object.

[System.Obsolete("deprecated")]
public virtual int TimezoneOffset { [Android.Runtime.Register("getTimezoneOffset", "()I", "GetGetTimezoneOffsetHandler")] get; }
[<System.Obsolete("deprecated")>]
[<get: Android.Runtime.Register("getTimezoneOffset", "()I", "GetGetTimezoneOffsetHandler")>]
member this.TimezoneOffset : int

Property Value

the time-zone offset, in minutes, for the current time zone.

Attributes

Remarks

Returns the offset, measured in minutes, for the local time zone relative to UTC that is appropriate for the time represented by this Date object.

For example, in Massachusetts, five time zones west of Greenwich: <blockquote>

new Date(96, 1, 14).getTimezoneOffset() returns 300

</blockquote> because on February 14, 1996, standard time (Eastern Standard Time) is in use, which is offset five hours from UTC; but: <blockquote>

new Date(96, 5, 1).getTimezoneOffset() returns 240

</blockquote> because on June 1, 1996, daylight saving time (Eastern Daylight Time) is in use, which is offset only four hours from UTC.

This method produces the same result as if it computed: <blockquote>

(this.getTime() - UTC(this.getYear(),
                                  this.getMonth(),
                                  this.getDate(),
                                  this.getHours(),
                                  this.getMinutes(),
                                  this.getSeconds())) / (60 * 1000)

</blockquote>

This member is deprecated. As of JDK version 1.1, replaced by -(Calendar.get(Calendar.ZONE_OFFSET) + Calendar.get(Calendar.DST_OFFSET)) / (60 * 1000).

Java documentation for java.util.Date.getTimezoneOffset().

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