03.05.2013 Views

FLASH® LITE™ 2.x - Adobe Help and Support

FLASH® LITE™ 2.x - Adobe Help and Support

FLASH® LITE™ 2.x - Adobe Help and Support

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Date constructor<br />

public Date([yearOrTimevalue:Number], [month:Number], [date:Number],<br />

[hour:Number], [minute:Number], [second:Number], [millisecond:Number])<br />

Constructs a new Date object that holds the specified date <strong>and</strong> time.<br />

The Date() constructor takes up to seven parameters (year, month, ..., millisecond) to specify<br />

a date <strong>and</strong> time to the millisecond. Alternatively, you can pass a single value to the Date()<br />

constructor that indicates a time value based on the number of milliseconds since January 1,<br />

1970 0:00:000 GMT. Or you can specify no parameters, <strong>and</strong> the Date() date object is<br />

assigned the current date <strong>and</strong> time.<br />

For example, this code shows several different ways to create a Date object:<br />

var d1:Date = new Date();<br />

var d3:Date = new Date(2000, 0, 1);<br />

var d4:Date = new Date(65, 2, 6, 9, 30, 15, 0);<br />

var d5:Date = new Date(-14159025000);<br />

In the first line of code, a Date object is set to the time when the assignment statement is run.<br />

In the second line, a Date object is created with year, month, <strong>and</strong> date parameters passed to it,<br />

resulting in the time 0:00:00 GMT January 1, 2000.<br />

In the third line, a Date object is created with year, month, <strong>and</strong> date parameters passed to it,<br />

resulting in the time 09:30:15 GMT (+ 0 milliseconds) March 6, 1965. Note that since the<br />

year parameter is specified as a two-digit integer, it is interpreted as 1965.<br />

In the fourth line, only one parameter is passed, which is a time value representing the<br />

number of milliseconds before or after 0:00:00 GMT January 1, 1970; since the value is<br />

negative, it represents a time before 0:00:00 GMT January 1, 1970, <strong>and</strong> in this case the time is<br />

02:56:15 GMT July, 21 1969.<br />

Parameters<br />

yearOrTimevalue:Number [optional] - If other parameters are specified, this number<br />

represents a year (such as 1965); otherwise, it represents a time value. If the number represents<br />

a year, a value of 0 to 99 indicates 1900 through 1999; otherwise all four digits of the year<br />

must be specified. If the number represents a time value (no other parameters are specified), it<br />

is the number of milliseconds before or after 0:00:00 GMT January 1, 1970; a negative values<br />

represents a time before 0:00:00 GMT January 1, 1970, <strong>and</strong> a positive value represents a time<br />

after.<br />

month:Number [optional] - An integer from 0 (January) to 11 (December).<br />

date:Number [optional] - An integer from 1 to 31.<br />

hour:Number [optional] - An integer from 0 (midnight) to 23 (11 p.m.).<br />

308 ActionScript classes

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!