EasyManua.ls Logo

MACROMEDIA FLASH 8-FLASH LITE 2.X ACTIONSCRIPT LANGUAGE - Setyear (Date.setyear Method)

MACROMEDIA FLASH 8-FLASH LITE 2.X ACTIONSCRIPT LANGUAGE
780 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 355
Example
The following example initially creates a new Date object, setting the time and date to
8:00:00 a.m. on May 15, 2004, and uses
Date.setSeconds() to change the time to 8:30:45
a.m.:
var my_date:Date = new Date(2004,4,15,8,0,0);
trace(my_date.getUTCSeconds()); // output: 0
my_date.setUTCSeconds(45);
trace(my_date.getUTCSeconds()); // output: 45
setYear (Date.setYear method)
public setYear(year:Number) : Number
Sets the year for the specified Date object in local time and returns the new time in
milliseconds. Local time is determined by the operating system on which Flash Player is
running.
Availability: ActionScript 1.0; Flash Lite 2.0
Parameters
year:Number - A number that represents the year. If year is an integer between 0 and 99,
setYear sets the year at 1900 + year; otherwise, the year is the value of the year parameter.
Returns
Number - An integer.
Example
The following example creates a new Date object with the date set to May 25, 2004, uses
setYear() to change the year to 1999, and changes the year to 2003:
var my_date:Date = new Date(2004,4,25);
trace(my_date.getYear()); // output: 104
trace(my_date.getFullYear()); // output: 2004
my_date.setYear(99);
trace(my_date.getYear()); // output: 99
trace(my_date.getFullYear()); // output: 1999
my_date.setYear(2003);
trace(my_date.getYear()); // output: 103
trace(my_date.getFullYear()); // output: 2003

Table of Contents

Related product manuals