Partager via


TimeZone.GetOffset Method

Definition

Overloads

GetOffset(Int64)

Returns the offset of this time zone from UTC at the specified date.

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.

[Android.Runtime.Register("getOffset", "(J)I", "GetGetOffset_JHandler", ApiSince=24)]
public virtual int GetOffset (long date);
[<Android.Runtime.Register("getOffset", "(J)I", "GetGetOffset_JHandler", ApiSince=24)>]
abstract member GetOffset : int64 -> int
override this.GetOffset : int64 -> int

Parameters

date
Int64

the date represented in milliseconds since January 1, 1970 00:00:00 GMT

Returns

the amount of time in milliseconds to add to UTC to get local time.

Attributes

Remarks

Returns the offset of this time zone from UTC at the specified date. If Daylight Saving Time is in effect at the specified date, the offset value is adjusted with the amount of daylight saving.

Java documentation for android.icu.util.TimeZone.getOffset(long).

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

GetOffset(Int32, Int32, Int32, Int32, Int32, Int32)

Gets the time zone offset, for current date, modified in case of daylight savings.

[Android.Runtime.Register("getOffset", "(IIIIII)I", "GetGetOffset_IIIIIIHandler", ApiSince=24)]
public abstract int GetOffset (int era, int year, int month, int day, int dayOfWeek, int milliseconds);
[<Android.Runtime.Register("getOffset", "(IIIIII)I", "GetGetOffset_IIIIIIHandler", ApiSince=24)>]
abstract member GetOffset : int * int * int * int * int * int -> int

Parameters

era
Int32

the era of the given date.

year
Int32

the year in the given date.

month
Int32

the month in the given date. Month is 0-based. e.g., 0 for January.

day
Int32

the day-in-month of the given date.

dayOfWeek
Int32

the day-of-week of the given date.

milliseconds
Int32

the millis in day in <em>standard</em> local time.

Returns

the offset to add to GMT to get local time.

Attributes

Remarks

Gets the time zone offset, for current date, modified in case of daylight savings. This is the offset to add to UTC to get local time.

Java documentation for android.icu.util.TimeZone.getOffset(int, int, int, int, int, int).

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

GetOffset(Int64, Boolean, Int32[])

Returns the time zone raw and GMT offset for the given moment in time.

[Android.Runtime.Register("getOffset", "(JZ[I)V", "GetGetOffset_JZarrayIHandler", ApiSince=24)]
public virtual void GetOffset (long date, bool local, int[]? offsets);
[<Android.Runtime.Register("getOffset", "(JZ[I)V", "GetGetOffset_JZarrayIHandler", ApiSince=24)>]
abstract member GetOffset : int64 * bool * int[] -> unit
override this.GetOffset : int64 * bool * int[] -> unit

Parameters

date
Int64

moment in time for which to return offsets, in units of milliseconds from January 1, 1970 0:00 GMT, either GMT time or local wall time, depending on local.

local
Boolean

if true, date is local wall time; otherwise it is in GMT time.

offsets
Int32[]

output parameter to receive the raw offset, that is, the offset not including DST adjustments, in offsets[0], and the DST offset, that is, the offset to be added to rawOffset to obtain the total offset between local and GMT time, in offsets[1]. If DST is not in effect, the DST offset is zero; otherwise it is a positive value, typically one hour.

Attributes

Remarks

Returns the time zone raw and GMT offset for the given moment in time. Upon return, local-millis = GMT-millis + rawOffset + dstOffset. All computations are performed in the proleptic Gregorian calendar. The default implementation in the TimeZone class delegates to the 8-argument getOffset().

Java documentation for android.icu.util.TimeZone.getOffset(long, boolean, int[]).

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