Skip to content
Reference > Methods

timezoneOffset(unixEpochMillis,timezone)

Definition

Long timezoneOffset(Number unixEpochMillis, String timezone)

Description

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

Parameter Definition

Name Type Description
unixEpochMillis Number Number of milliseconds since 1/1/1970 in UTC timezone
timezone String TimeZone to get offset for

Examples

1
2
3
4
Long r1 = timezoneOffset(0,"EST5EDT"); // r1 == -18000000
Long r2 = timezoneOffset(1152590400000L,"EST5EDT"); // r2 == -14400000
Long r3 = timezoneOffset(1165640400000L,"EST5EDT"); // r3 == -18000000
Long r4 = timezoneOffset(1234567L,"UTC"); // r4 == 0