
Date.getTimezoneOffset() Method
This is the Title of the Book, eMatter Edition
Copyright © 2007 O’Reilly & Associates, Inc. All rights reserved.
510
|
ActionScript Language Reference
Example
Suppose we place the following code on frame 10 of a movie:
time1 = new Date();
Then we place the following code on frame 20 of a movie:
time2 = new Date();
With the following code, we can determine the amount of time that elapsed, in millisec-
onds, between frames 10 and 20 of our movie:
elapsedTime = time2.getTime() - time1.getTime();
Note that Flash’s global getTimer() function also gives us access to elapsed time in a movie.
See Also
Date.setTime(), getTimer(), setInterval()
Date.getTimezoneOffset() Method
the number of minutes between local time and UTC (a.k.a. GMT)
Flash 5
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 savings 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 ...