330
ActionScript classes
Date constructor
public 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.
The
Date()
constructor takes up to seven parameters (year, month, ..., millisecond) to specify
a date and time to the millisecond. Alternatively, you can pass a single value to the
Date()
constructor that indicates a time value based on the number of milliseconds since January 1,
1970 0:00:000 GMT. Or you can specify no parameters, and the
Date()
date object is
assigned the current date and time.
For example, this code shows several different ways to create a Date object:
var d1:Date = new Date();
var d3:Date = new Date(2000, 0, 1);
var d4:Date = new Date(65, 2, 6, 9, 30, 15, 0);
var d5:Date = new Date(-14159025000);
In the first line of code, a Date object is set to the time when the assignment statement is run.
In the second line, a Date object is created with year, month, and date parameters passed to it,
resulting in the time 0:00:00 GMT January 1, 2000.
In the third line, a Date object is created with year, month, and date parameters passed to it,
resulting in the time 09:30:15 GMT (+ 0 milliseconds) March 6, 1965. Note that since the
year parameter is specified as a two-digit integer, it is interpreted as 1965.
In the fourth line, only one parameter is passed, which is a time value representing the
number of milliseconds before or after 0:00:00 GMT January 1, 1970; since the value is
negative, it represents a time
before
0:00:00 GMT January 1, 1970, and in this case the time is
02:56:15 GMT July, 21 1969.
Availability:
ActionScript 1.0; Flash Lite 2.0
Parameters
yearOrTimevalue
:
Number
[optional] - If other parameters are specified, this number
represents a year (such as 1965); otherwise, it represents a time value. If the number represents
a year, a value of 0 to 99 indicates 1900 through 1999; otherwise all four digits of the year
must be specified. If the number represents a time value (no other parameters are specified), it
is the number of milliseconds before or after 0:00:00 GMT January 1, 1970; a negative values
represents a time
before
0:00:00 GMT January 1, 1970, and a positive value represents a time
after.
month
:
Number
[optional] - An integer from 0 (January) to 11 (December).
date
:
Number
[optional] - An integer from 1 to 31.
Summary of Contents for FLASHLITE2 ACTIONSCRIPT-LANGUAGE
Page 1: ...Flash Lite 2 x ActionScript Language Reference...
Page 22: ...22 Contents...
Page 244: ...244 ActionScript language elements...
Page 760: ...760 ActionScript classes...