![]() ![]() ![]() | |
![]() | |
![]() | |
![]() |
Flash Player 5.
The Date class 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 Flash Player is running. The methods of the Date class are not static, but apply only to the individual Date object specified when the method is called. The Date.UTC()
method is an exception; it is a static method.
The Date class handles daylight saving time differently depending on the operating system and Flash Player version. Flash Player 6 and later versions handle daylight saving time on the following operating systems in these ways:
Flash Player 5 handles daylight saving time on the following operating systems as follows:
To call the methods of the Date class, you must first create a Date object using the constructor for the Date class, described later in this section.
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. |
Flash Player 5.
new Date()new Date(
year
,
month
[,
date
[,
hour
[,
minute
[,
second
[,
millisecond
]]]]])
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.
Nothing.
Object; constructs a new Date object that holds the current date and time, or the date specified.
The following example retrieves the current date and time.
now_date = new Date();
The following example creates a new Date object for Gary's birthday, August 12, 1974. (Because the month parameter is zero-based, the example uses 7 for the month, not 8.)
garyBirthday_date = new Date (74, 7, 12);
The following example creates a new Date object, concatenates the returned values of Date.getMonth()
, Date.getDate()
, and Date.getFullYear()
, and displays them in the text field specified by the variable date_str.
today_date = new Date(); date_str = ((today_date.getMonth() + 1) + "/" + today_date.getDate() + "/" + today_date.getFullYear());
![]() | |
![]() | |
![]() | |
![]() ![]() ![]() |