EasyManua.ls Logo

MACROMEDIA FLASH 8-ACTIONSCRIPT 2.0 LANGUAGE - Page 481

MACROMEDIA FLASH 8-ACTIONSCRIPT 2.0 LANGUAGE
1378 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Date 481
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 Player 5
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.
hour:Number [optional] - An integer from 0 (midnight) to 23 (11 p.m.).
minute:Number [optional] - An integer from 0 to 59.
second:Number [optional] - An integer from 0 to 59.
millisecond:Number [optional] - An integer from 0 to 999 of milliseconds.
Example
The following example retrieves the current date and time:
var now_date:Date = new Date();
The following example creates a new Date object for Mary's birthday, August 12, 1974
(because the month parameter is zero-based, the example uses 7 for the month, not 8):
var maryBirthday:Date = new Date (74, 7, 12);
The following example creates a new Date object and concatenates the returned values of
Date.getMonth(), Date.getDate(), and Date.getFullYear():
var today_date:Date = new Date();
var date_str:String = ((today_date.getMonth()+1)+"/
"+today_date.getDate()+"/"+today_date.getFullYear());
trace(date_str); // displays current date in United States date format

Table of Contents

Related product manuals