
delete Operator
This is the Title of the Book, eMatter Edition
Copyright © 2007 O’Reilly & Associates, Inc. All rights reserved.
Alphabetical Language Reference
|
519
Example
The following code shows how to measure the milliseconds elapsed between midnight,
January 1, 1970 and midnight, January 1, 2000 in UTC time:
trace(Date.UTC(2000, 0) + " milliseconds passed between 1970 and 2000.");
// Displays: "946684800000 milliseconds passed between 1970 and 2000."
Here we use those elapsed milliseconds to construct a UTC-time-based Date object:
nowUTC = new Date(Date.UTC(2000, 0));
If we invoke that code in EST (Eastern Standard Time), which is 5 hours behind UTC,
nowUTC represents the local time, 7 P.M. on December 31, 1999. When we check the hour
using the non-UTC method getHours(), we get the local hour, 19 (7 P.M. in a 24-hour
clock):
trace(nowUTC.getHours()); // Displays: 19
But when we check the hour using the UTC method getUTCHours(), we get the correct
UTC hour, (midnight in a 24-hour clock):
trace(nowUTC.getUTCHours()); // Displays: 0
See Also
Date(), Date.setTime(), the Date class
Date.valueOf() Method
the number of milliseconds between January 1, 1970 and the time of the Date object
Flash 5
date.valueOf()
Returns
An integer expressing the number of milliseconds between the time of the Date object and
midnight, January 1, 1970—positive if after January 1, 1970; negative if before.
Description
In practice, ...