Creating a Date Object : Date « Development « Flash / Flex / ActionScript






Creating a Date Object

 


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

        var dNow:Date = new Date();
        trace(dNow.toString());
    }
  }
}

        








Related examples in the same category

1.Making a Date Based on Epoch Milliseconds: var dDateObject:Date = new Date(epochMilliseconds);
2.Making a Date Based on Year or Month: var dDateObject:Date = new Date(year, month, date, hour, minute, second, millisecond);
3.Use four digit to construct the year field
4.Send the Date constructor a series of values for the year, month, day of the month, hour, minute, second, and millisecond to represent.
5.Hours are measured in 24-hour/military time, so they can range from 0 (12 a.m.) to 23 (11 p.m.).
6.Use an array of the proper names to translate directly
7.Create a Date object is by passing it a string representing a time.
8.Get date and month from a Date object
9.Use getUTCFullYear() to determine the UTC year that corresponds to a given local date
10.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.
11.getDay() or getUTCDay() methods return the day of the week as an integer from 0 to 6.
12.Getting the Hours, Minutes, Seconds, and Milliseconds
13.Call getter method of Date object
14.Get time
15.Getting the Time Zone Offset
16.setFullYear() method takes an integer parameter that is interpreted literally in all ranges, even 0 to 99.
17.Setting the Month
18.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.
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.