D-E > Date (object) |
![]() ![]() ![]() |
Date (object)
The Date object lets you retrieve date and time values relative to universal time (Greenwich Mean Time, now called universal time or UTC) or relative to the operating system on which the Flash Player is running. The methods of the Date object are not static, but apply only to the individual instance of the Date object specified when the method is called. The Date.UTC
method is an exception; it is a static method.
The Date object handles daylight saving time differently depending on the operating system and the Flash Player version. Flash Player 6 handles daylight saving time on the following operating systems in these ways:
![]() |
Windowsthe Date object automatically adjusts its output for daylight saving time. The Date object detects whether daylight saving time is employed in the current locale, and if so, it detects what the standard-to-daylight-saving-time transition date and times are. However, the transition dates currently in effect are applied to dates in the past and the future, so the daylight saving time bias may be calculated incorrectly for dates in the past when the locale had different transition dates. |
![]() |
Mac OS 8 and 9the Date object uses the current daylight-saving-time bias, regardless of the date or time being calculated. For example, in the U.S. Pacific time zone during August, when daylight saving time (DST) is in effect, a Date object containing the date Jan 1 2001 still reports DST time even though DST isn't in effect during January. This problem cannot be remedied on Mac OS 8 or 9 because a time zone information database is not available. |
![]() |
Mac OS Xthe Date object automatically adjusts its output for daylight saving time. The timezone information database in Mac OS X is used to determine whether any date or time in the present or past should have a daylight-saving-time bias applied. |
Flash Player 5 handles daylight saving time on the following operating systems as follows:
![]() |
Mac OS 8 and 9the behavior is the same as described for Flash Player 6. |
![]() |
Windowsthe U.S. rules for daylight saving time are always applied, which leads to incorrect transitions in Europe and other areas that employ daylight saving time but have different transition times than the U.S. Flash correctly detects whether DST is employed in the current locale. |
To call the methods of the Date object, you must first create an instance of the Date object using the constructor for the Date object.
The Date object requires Flash Player 5.
Method Description Returns the day of the month according to local time. Returns the day of the week according to local time. Returns the four-digit year according to local time. Returns the hour according to local time. Returns the milliseconds according to local time. Returns the minutes according to local time. Returns the month according to local time. Returns the seconds according to local time. Returns the number of milliseconds since midnight January 1, 1970, universal time. Returns the difference, in minutes, between the computer's local time and the universal time. Returns the day (date) of the month according to universal time. Returns the day of the week according to universal time. Returns the four-digit year according to universal time. Returns the hour according to universal time. Returns the milliseconds according to universal time. Returns the minutes according to universal time. Returns the month according to universal time. Returns the seconds according to universal time. Returns the year according to local time. Sets the day of the month according to local time. Returns the new time in milliseconds. Sets the full year according to local time. Returns the new time in milliseconds. Sets the hour according to local time. Returns the new time in milliseconds. Sets the milliseconds according to local time. Returns the new time in milliseconds. Sets the minutes according to local time. Returns the new time in milliseconds. Sets the month according to local time. Returns the new time in milliseconds. Sets the seconds according to local time. Returns the new time in milliseconds. Sets the date in milliseconds. Returns the new time in milliseconds. Sets the date according to universal time. Returns the new time in milliseconds. Sets the year according to universal time. Returns the new time in milliseconds. Sets the hour according to universal time. Returns the new time in milliseconds. Sets the milliseconds according to universal time. Returns the new time in milliseconds. Sets the minutes according to universal time. Returns the new time in milliseconds. Sets the month according to universal time. Returns the new time in milliseconds. Sets the seconds according to universal time. Returns the new time in milliseconds. Sets the year according to local time. Returns a string value representing the date and time stored in the specified Date object. Returns the number of milliseconds between midnight on January 1, 1970, universal time, and the specified time.
Method summary for Date object
Constructor for the Date object
Availability
Flash Player 5.
Usage
new Date()new Date(
year
,
month
[,
date
[,
hour
[,
minute
[,
second
[,
millisecond
]]]]])
Parameters
year
A value of 0 to 99 indicates 1900 though 1999; otherwise all four digits of the year must be specified.
month
An integer from 0 (January) to 11 (December).
date
An integer from 1 to 31. This parameter is optional.
hour
An integer from 0 (midnight) to 23 (11 p.m.).
minute
An integer from 0 to 59. This parameter is optional.
second
An integer from 0 to 59. This parameter is optional.
millisecond
An integer from 0 to 999. This parameter is optional.
Returns
An integer.
Description
Object; constructs a new Date object that holds the current date and time, or the date specified.
Example
The following example retrieves the current date and time.
now = new Date();
The following example creates a new Date object for Gary's birthday, August 7, 1974.
gary_birthday = new Date (74, 7, 7);
The following example creates a new Date object, concatenates the returned values of the Date object methods getMonth
, getDate
, and getFullYear
, and displays them in the text field specified by the variable dateTextField.
myDate = new Date(); dateTextField = ((myDate.getMonth() + 1) + "/" + myDate.getDate() + "/" + myDate.getFullYear());
![]() ![]() ![]() |