Date > Date (object)
Date (object)The Date object allows you to retrieve date and time values relative to universal time (Greenwich Mean Time, now called Universal Coordinated Time) or relative to the operating system on which the Flash Player is running. To call the methods of the Date object, you must first create an instance of the Date object using the constructor.
The Date object requires the Flash 5 Player.
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.
getDate Returns the day of the month of the specified Date object according to local time. Returns the day of the month for the specified Date object according to local time. Returns the four-digit year of the specified Date object according to local time. Returns the hour of the specified Date object according to local time. Returns the milliseconds of the specified Date object according to local time. Returns the minutes of the specified Date object according to local time. Returns the month of the specified Date object according to local time. Returns the seconds of the specified Date object according to local time. Returns the number of milliseconds since midnight January 1, 1970, universal time, for the specified Date object. Returns the difference, in minutes, between the computer's local time and the universal time. Returns the day (date) of the month of the specified Date object according to universal time. Returns the day of the week of the specified Date object according to universal time. Returns the four-digit year of the specified Date object according to universal time. Returns the hour of the specified Date object according to universal time. Returns the milliseconds of the specified Date object according to universal time. Returns the minute of the specified Date object according to universal time. Returns the month of the specified Date object according to universal time. Returns the seconds of the specified Date object according to universal time. Returns the year of the specified Date object according to local time. Returns the day of the month of a specified Date object according to local time. Sets the full year for a Date object according to local time. Sets the hours for a Date object according to local time. Sets the milliseconds for a Date object according to local time. Sets the minutes for a Date object according to local time. Sets the month for a Date object according to local time. Sets the seconds for a Date object according to local time. Sets the date for the specified Date object in milliseconds. Sets the date of the specified Date object according to universal time. Sets the year of the specified Date object according to universal time. Sets the hour of the specified Date object according to universal time. Sets the milliseconds of the specified Date object according to universal time. Sets the minute of the specified Date object according to universal time. Sets the month represented by the specified Date object according to universal time. Sets the seconds of the specified Date object according to universal time. Sets the year for the specified Date object 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
Method
Description
getDay
getFullYear
getHours
getMilliseconds
getMinutes
getMonth
getSeconds
getTime
getTimezoneOffset
getUTCDate
getUTCDay
getUTCFullYear
getUTCHours
getUTCMilliseconds
getUTCMinutes
getUTCMonth
getUTCSeconds
getYear
setDate
setFullYear
setHours
setMilliseconds
setMinutes
setMonth
setSeconds
setTime
setUTCDate
setUTCFullYear
setUTCHours
setUTCMilliseconds
setUTCMinutes
setUTCMonth
setUTCSeconds
setYear
toString
Date.UTC
Constructor for the Date object
Syntax
new Date();new Date(
year
[,
month
[,
date
[,
hour
[,
minute
[,
second
[,
millisecond
]]]]]] );
Arguments
year
A value of 0 to 99 indicates 1900 though 1999, otherwise all 4 digits of the year must be specified.
month
An integer from 0 (January) to 11 (December). This argument is optional.
date
An integer from 1 to 31. This argument is optional.
hour
An integer from 0 (midnight) to 23 (11 p.m.).
minute
An integer from 0 to 59. This argument is optional.
second
An integer from 0 to 59. This argument is optional.
millisecond
An integer from 0 to 999. This argument is optional.
Description
Object; constructs a new Date object holding the current date and time.
Player
Flash 5 or later.
Example
The following example retrieves the current date and time:
now = new Date();
The following example creates a new Date object for a 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() + "/" + myDate.getDate() + "/" + mydate.getFullYear());