Name

Date.getTimezoneOffset( ) Method — the number of minutes between local time and UTC (a.k.a. GMT)

Availability

Flash 5

Synopsis

date.getTimezoneOffset( )

Returns

An integer representing the current number of minutes between the local time zone and the actual UTC (Greenwich meridian) time. Positive if local time is behind UTC; negative if local time is ahead of UTC. Includes adjustments for local daylight saving time depending on the day of the year.

Example

When invoked in Eastern Daylight Time (EDT) during daylight savings, the following code returns the value 240 (240 minutes is 4 hours):

myDate = new Date( );
trace(myDate.getTimezoneOffset( ));  // Displays: 240

However, when invoked in EDT, during non-daylight savings times of year, the same code returns 300 (300 minutes is 5 hours), which is the real offset between Eastern Standard Time (EST) and UTC.

Get ActionScript: The Definitive Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.