Pass negative values to these methods. Date starts with 0, January, and subtracts. Thus, a value of –1 is the same as saying December of the previous year. : Date « Development « Flash / Flex / ActionScript






Pass negative values to these methods. Date starts with 0, January, and subtracts. Thus, a value of –1 is the same as saying December of the previous year.

 

package{
  import flash.display.Sprite;
  
  public class Main extends Sprite{
    public function Main(){

        var dSometime:Date = new Date(2003, 5, 23); // June 23, 2003
        dSometime.setMonth(-1);  // December 23, 2002
        trace(dSometime);
    }
  }
}

        








Related examples in the same category

1.Creating a Date Object
2.Making a Date Based on Epoch Milliseconds: var dDateObject:Date = new Date(epochMilliseconds);
3.Making a Date Based on Year or Month: var dDateObject:Date = new Date(year, month, date, hour, minute, second, millisecond);
4.Use four digit to construct the year field
5.Send the Date constructor a series of values for the year, month, day of the month, hour, minute, second, and millisecond to represent.
6.Hours are measured in 24-hour/military time, so they can range from 0 (12 a.m.) to 23 (11 p.m.).
7.Use an array of the proper names to translate directly
8.Create a Date object is by passing it a string representing a time.
9.Get date and month from a Date object
10.Use getUTCFullYear() to determine the UTC year that corresponds to a given local date
11.Use the getDate() and getUTCDate() methods to return the values of the local day of the month and the corresponding day of the month UTC, respectively.
12.getDay() or getUTCDay() methods return the day of the week as an integer from 0 to 6.
13.Getting the Hours, Minutes, Seconds, and Milliseconds
14.Call getter method of Date object
15.Get time
16.Getting the Time Zone Offset
17.setFullYear() method takes an integer parameter that is interpreted literally in all ranges, even 0 to 99.
18.Setting the Month
19.Setting the Date: use the setDate() and setUTCDate() methods to set the day of the month for a Date object.
20.Setting the Hours, Minutes, Seconds, and Milliseconds
21.Setting the Time
22.The toString() method is inherited from the Object class, and it returns a string representing the value.
23.UTC() is a method that returns the time value in milliseconds from midnight on January 1, 1970
24.Use UTC method to construct date object
25.using the Date class's static parse() method.