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.


 
Method summary for Date object
Method Description

getDate

Returns the day of the month of the specified Date object according to local time.

getDay

Returns the day of the month for the specified Date object according to local time.

getFullYear

Returns the four-digit year of the specified Date object according to local time.

getHours

Returns the hour of the specified Date object according to local time.

getMilliseconds

Returns the milliseconds of the specified Date object according to local time.

getMinutes

Returns the minutes of the specified Date object according to local time.

getMonth

Returns the month of the specified Date object according to local time.

getSeconds

Returns the seconds of the specified Date object according to local time.

getTime

Returns the number of milliseconds since midnight January 1, 1970, universal time, for the specified Date object.

getTimezoneOffset

Returns the difference, in minutes, between the computer's local time and the universal time.

getUTCDate

Returns the day (date) of the month of the specified Date object according to universal time.

getUTCDay

Returns the day of the week of the specified Date object according to universal time.

getUTCFullYear

Returns the four-digit year of the specified Date object according to universal time.

getUTCHours

Returns the hour of the specified Date object according to universal time.

getUTCMilliseconds

Returns the milliseconds of the specified Date object according to universal time.

getUTCMinutes

Returns the minute of the specified Date object according to universal time.

getUTCMonth

Returns the month of the specified Date object according to universal time.

getUTCSeconds

Returns the seconds of the specified Date object according to universal time.

getYear

Returns the year of the specified Date object according to local time.

setDate

Returns the day of the month of a specified Date object according to local time.

setFullYear

Sets the full year for a Date object according to local time.

setHours

Sets the hours for a Date object according to local time.

setMilliseconds

Sets the milliseconds for a Date object according to local time.

setMinutes

Sets the minutes for a Date object according to local time.

setMonth

Sets the month for a Date object according to local time.

setSeconds

Sets the seconds for a Date object according to local time.

setTime

Sets the date for the specified Date object in milliseconds.

setUTCDate

Sets the date of the specified Date object according to universal time.

setUTCFullYear

Sets the year of the specified Date object according to universal time.

setUTCHours

Sets the hour of the specified Date object according to universal time.

setUTCMilliseconds

Sets the milliseconds of the specified Date object according to universal time.

setUTCMinutes

Sets the minute of the specified Date object according to universal time.

setUTCMonth

Sets the month represented by the specified Date object according to universal time.

setUTCSeconds

Sets the seconds of the specified Date object according to universal time.

setYear

Sets the year for the specified Date object according to local time.

toString

Returns a string value representing the date and time stored in the specified Date object.

Date.UTC

Returns the number of milliseconds between midnight on January 1, 1970, universal time, and the specified time.



 
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());