Flash Lite 2.x and 3.0 ActionScript Language Reference

Date

Object
    |
    +-Date

public class Date
extends Object

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:

  • Windows - the 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 the standard-to-daylight saving time transition date and times. However, the transition dates currently in effect are applied to dates in the past and the future, so the daylight saving time bias might calculate incorrectly for dates in the past when the locale had different transition dates.
  • Mac OS X - the Date object automatically adjusts its output for daylight saving time. The time zone 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.
  • Mac OS 9 - the operating system provides only enough information to determine whether the current date and time should have a daylight saving time bias applied. Accordingly, the date object assumes that the current daylight saving time bias applies to all dates and times in the past or future.

Flash Player 5 handles daylight saving time on the following operating systems as follows:

  • Windows - the 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 daylight saving time is used in the current locale.

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.

Property summary

Properties inherited from class Object

constructor (Object.constructor property), __proto__ (Object.__proto__ property), prototype (Object.prototype property), __resolve (Object.__resolve property)

Constructor summary

Signature

Description

Date([yearOrTimevalue:Number], [month:Number], [date:Number], [hour:Number], [minute:Number], [second:Number], [millisecond:Number])

Constructs a new Date object that holds the specified date and time.

Method summary

Modifiers

Signature

Description

 

getDate() : Number

Returns the day of the month (an integer from 1 to 31) of the specified Date object according to local time.

 

getDay() : Number

Returns the day of the week (0 for Sunday, 1 for Monday, and so on) of the specified Date object according to local time.

 

getFullYear() : Number

Returns the full year (a four-digit number, such as 2000) of the specified Date object, according to local time.

 

getHours() : Number

Returns the hour (an integer from 0 to 23) of the specified Date object, according to local time.

 

getLocaleLongDate() : String

Returns a string representing the current date, in long form, formatted according to the currently defined locale.

 

getLocaleShortDate() : String

Returns a string representing the current date, in short form, formatted according to the currently defined locale.

 

getLocaleTime() : String

Returns a string representing the current time, formatted according to the currently defined locale.

 

getMilliseconds() : Number

Returns the milliseconds (an integer from 0 to 999) of the specified Date object, according to local time.

 

getMinutes() : Number

Returns the minutes (an integer from 0 to 59) of the specified Date object, according to local time.

 

getMonth() : Number

Returns the month (0 for January, 1 for February, and so on) of the specified Date object, according to local time.

 

getSeconds() : Number

Returns the seconds (an integer from 0 to 59) of the specified Date object, according to local time.

 

getTime() : Number

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

 

getTimezoneOffset() : Number

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

 

getUTCDate() : Number

Returns the day of the month (an integer from 1 to 31) in the specified Date object, according to universal time.

 

getUTCDay() : Number

Returns the day of the week (0 for Sunday, 1 for Monday, and so on) of the specified Date object, according to universal time.

 

getUTCFullYear() : Number

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

 

getUTCHours() : Number

Returns the hour (an integer from 0 to 23) of the specified Date object, according to universal time.

 

getUTCMilliseconds() : Number

Returns the milliseconds (an integer from 0 to 999) of the specified Date object, according to universal time.

 

getUTCMinutes() : Number

Returns the minutes (an integer from 0 to 59) of the specified Date object, according to universal time.

 

getUTCMonth() : Number

Returns the month (0 [January] to 11 [December]) of the specified Date object, according to universal time.

 

getUTCSeconds() : Number

Returns the seconds (an integer from 0 to 59) of the specified Date object, according to universal time.

 

getUTCYear() : Number

Returns the year of this Date according to universal time (UTC).

 

getYear() : Number

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

 

setDate(date:Number) : Number

Sets the day of the month for the specified Date object, according to local time, and returns the new time in milliseconds.

 

setFullYear(year:Number, [month:Number], [date:Number]) : Number

Sets the year of the specified Date object, according to local time and returns the new time in milliseconds.

 

setHours(hour:Number) : Number

Sets the hours for the specified Date object according to local time and returns the new time in milliseconds.

 

setMilliseconds(millisecond:Number) : Number

Sets the milliseconds for the specified Date object according to local time and returns the new time in milliseconds.

 

setMinutes(minute:Number) : Number

Sets the minutes for a specified Date object according to local time and returns the new time in milliseconds.

 

setMonth(month:Number, [date:Number]) : Number

Sets the month for the specified Date object in local time and returns the new time in milliseconds.

 

setSeconds(second:Number) : Number

Sets the seconds for the specified Date object in local time and returns the new time in milliseconds.

 

setTime(millisecond:Number) : Number

Sets the date for the specified Date object in milliseconds since midnight on January 1, 1970, and returns the new time in milliseconds.

 

setUTCDate(date:Number) : Number

Sets the date for the specified Date object in universal time and returns the new time in milliseconds.

 

setUTCFullYear(year:Number, [month:Number], [date:Number]) : Number

Sets the year for the specified Date object (my_date) in universal time and returns the new time in milliseconds.

 

setUTCHours(hour:Number, [minute:Number], [second:Number], [millisecond:Number]) : Number

Sets the hour for the specified Date object in universal time and returns the new time in milliseconds.

 

setUTCMilliseconds(millisecond:Number) : Number

Sets the milliseconds for the specified Date object in universal time and returns the new time in milliseconds.

 

setUTCMinutes(minute:Number, [second:Number], [millisecond:Number]) : Number

Sets the minute for the specified Date object in universal time and returns the new time in milliseconds.

 

setUTCMonth(month:Number, [date:Number]) : Number

Sets the month, and optionally the day, for the specified Date object in universal time and returns the new time in milliseconds.

 

setUTCSeconds(second:Number, [millisecond:Number]) : Number

Sets the seconds for the specified Date object in universal time and returns the new time in milliseconds.

 

setYear(year:Number) : Number

Sets the year for the specified Date object in local time and returns the new time in milliseconds.

 

toString() : String

Returns a string value for the specified date object in a readable format.

static

UTC(year:Number, month:Number, [date:Number], [hour:Number], [minute:Number], [second:Number], [millisecond:Number]) : Number

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

 

valueOf() : Number

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

Methods inherited from class Object

addProperty (Object.addProperty method), hasOwnProperty (Object.hasOwnProperty method), isPropertyEnumerable (Object.isPropertyEnumerable method), isPrototypeOf (Object.isPrototypeOf method), registerClass (Object.registerClass method), toString (Object.toString method), unwatch (Object.unwatch method), valueOf (Object.valueOf method), watch (Object.watch method)