Flash date, time sample

February 19th, 2010

Actionscript 3.0:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
var now:Date = new Date();
 
trace("date   :" + now.getDate()); // 19
 
var monthLabels:Array = new Array("January",
                  "February",
                  "March",
                  "April",
                  "May",
                  "June",
                  "July",
                  "August",
                  "September",
                  "October",
                  "November",
                  "December");
 
 
trace("month  :" + now.getMonth()); // 1
trace("month  :" + monthLabels[now.getMonth()]); //February
 
trace("year   :" + now.getUTCFullYear()); // 2010
 
var weekDayLabels:Array = new Array("Sunday",
                    "Monday",
                    "Tuesday",
                    "Wednesday",
                    "Thursday",
                    "Friday",
                    "Saturday");
 
trace("day    :" + now.getDay());            // 5
trace("day    :" + weekDayLabels[now.getDay()]); // Friday
 
trace("time   :" + now.getHours() + ":" + now.getMinutes() + ":" + now.getSeconds()); // 6:39:57
Bookmark and Share

One Response to “Flash date, time sample”

  1. Business Advice Says:

    I like the information that you wrote here. Keep up the good work.

Leave a Reply