1 // makeswf -v 5 -r 1 -o date-5.swf date.as
2 // makeswf -v 6 -r 1 -o date-6.swf date.as
3 // makeswf -v 7 -r 1 -o date-7.swf date.as
9 trace
(d
.getTime
() + " " + d
.valueOf
() + ": " + d
.toString
());
10 trace
(d
.getFullYear
() + "/" + d
.getYear
() + "-" + d
.getMonth
() + "-" + d
.getDate
() + " " + d
.getDay
() + " " + d
.getHours
() + ":" + d
.getMinutes
() + ":" + d
.getSeconds
() + "." + d
.getMilliseconds
());
11 trace
(d
.getUTCFullYear
() + "/" + d
.getUTCYear
() + "-" + d
.getUTCMonth
() + "-" + d
.getUTCDate
() + " " + d
.getUTCDay
() + " " + d
.getUTCHours
() + ":" + d
.getUTCMinutes
() + ":" + d
.getUTCSeconds
() + "." + d
.getUTCMilliseconds
());
16 return val
+ " (" + typeof (val
) + ")";
19 yearValues
= [1983, 83, 0, 100, 99, 101, -100, -500, -271823, -271822, -271821, 275759, 275760, 275761, 100000000000000, -100000000000000];
20 yearValues
= yearValues
.concat
(values
);
21 monthValues
= [5, 0, 11, 12, -1, 20, -20];
22 monthValues
= monthValues
.concat
(values
);
23 dateValues
= [25, 1, 10, 29, 30, 31, 32, 0, -1, 200, -20];
24 dateValues
= dateValues
.concat
(values
);
25 hourValues
= [13, 0, 5, 19, 23, -1, 24, 30, -20];
26 hourValues
= hourValues
.concat
(values
);
27 minuteValues
= [50, 0, 10, 48, 59, -1, 60, -20, 200];
28 secondValues
= minuteValues
= minuteValues
.concat
(values
);
29 millisecondValues
= [300, 0, 12, 123, 580, 900, 934, 999, -1, 1000, 3123, -213];
30 millisecondValues
= millisecondValues
.concat
(values
);
34 for (i
= 0; i
< yearValues
.length
; i
++) {
35 trace
("Date.UTC (" + p
(yearValues
[i
]) +")");
36 val
= Date.UTC
(yearValues
[i
]);
39 traced
(new Date (val
));
40 trace
("Date.UTC (" + p
(yearValues
[i
]) + ", " + monthValues
[0] + ", " + dateValues
[0] + ", " +
41 hourValues
[0] + ", " + minuteValues
[0] + ", " + secondValues
[0] + ", " +
42 millisecondValues
[0] + ")");
43 val
= Date.UTC
(yearValues
[i
], monthValues
[0], dateValues
[0], hourValues
[0], minuteValues
[0],
44 secondValues
[0], millisecondValues
[0]);
47 traced
(new Date (val
));
50 for (i
= 0; i
< monthValues
.length
; i
++) {
51 trace
("Date.UTC (" + yearValues
[0] + ", " + p
(monthValues
[i
]) + ")");
52 trace
(Date.UTC
(yearValues
[0], monthValues
[i
]));
53 trace
("Date.UTC (" + yearValues
[0] + ", " + p
(monthValues
[i
]) + ", " + dateValues
[0] + ", " +
54 hourValues
[0] + ", " + minuteValues
[0] + ", " + secondValues
[0] + ", " +
55 millisecondValues
[0] + ")");
56 trace
(Date.UTC
(yearValues
[0], monthValues
[i
], dateValues
[0], hourValues
[0], minuteValues
[0],
57 secondValues
[0], millisecondValues
[0]));
60 for (i
= 0; i
< dateValues
.length
; i
++) {
61 trace
("Date.UTC (" + yearValues
[0] + ", " + monthValues
[0] + ", " + p
(dateValues
[i
]) + ")");
62 trace
(Date.UTC
(yearValues
[0], monthValues
[0], dateValues
[i
]));
63 trace
("Date.UTC (" + yearValues
[0] + ", " + monthValues
[0] + ", " + p
(dateValues
[i
]) + ", " +
64 hourValues
[0] + ", " + minuteValues
[0] + ", " + secondValues
[0] + ", " +
65 millisecondValues
[0] + ")");
66 trace
(Date.UTC
(yearValues
[0], monthValues
[0], dateValues
[i
], hourValues
[0], minuteValues
[0],
67 secondValues
[0], millisecondValues
[0]));
70 for (i
= 0; i
< hourValues
.length
; i
++) {
71 trace
("Date.UTC (" + yearValues
[0] + ", " + monthValues
[0] + ", " + dateValues
[0] +
72 ", " + p
(hourValues
[i
]) + ")");
73 trace
(Date.UTC
(yearValues
[0], monthValues
[0], dateValues
[0], hourValues
[i
]));
74 trace
("Date.UTC (" + yearValues
[0] + ", " + monthValues
[0] + ", " + dateValues
[0] + ", " +
75 p
(hourValues
[i
]) + ", " + minuteValues
[0] + ", " + secondValues
[0] + ", " +
76 millisecondValues
[0] + ")");
77 trace
(Date.UTC
(yearValues
[0], monthValues
[0], dateValues
[0], hourValues
[i
], minuteValues
[0],
78 secondValues
[0], millisecondValues
[0]));
81 for (i
= 0; i
< minuteValues
.length
; i
++) {
82 trace
("Date.UTC (" + yearValues
[0] + ", " + monthValues
[0] + ", " + dateValues
[0] + ", " +
83 hourValues
[0] + ", " + p
(minuteValues
[i
]) + ")");
84 trace
(Date.UTC
(yearValues
[0], monthValues
[0], dateValues
[0], hourValues
[0], minuteValues
[i
]));
85 trace
("Date.UTC (" + yearValues
[0] + ", " + monthValues
[0] + ", " + dateValues
[0] + ", " +
86 hourValues
[0] + ", " + p
(minuteValues
[i
]) + ", " + secondValues
[0] + ", " +
87 millisecondValues
[0] + ")");
88 trace
(Date.UTC
(yearValues
[0], monthValues
[0], dateValues
[0], hourValues
[0], minuteValues
[i
],
89 secondValues
[0], millisecondValues
[0]));
92 for (i
= 0; i
< secondValues
.length
; i
++) {
93 trace
("Date.UTC (" + yearValues
[0] + ", " + monthValues
[0] + ", " + dateValues
[0] + ", " +
94 hourValues
[0] + ", " + minuteValues
[0] + ", " + p
(secondValues
[i
]) + ")");
95 trace
(Date.UTC
(yearValues
[0], monthValues
[0], dateValues
[0], hourValues
[0], minuteValues
[0],
97 trace
("Date.UTC (" + yearValues
[0] + ", " + monthValues
[0] + ", " + dateValues
[0] + ", " +
98 hourValues
[0] + ", " + minuteValues
[0] + ", " + p
(secondValues
[i
]) + ", " +
99 millisecondValues
[0] + ")");
100 trace
(Date.UTC
(yearValues
[0], monthValues
[0], dateValues
[0], hourValues
[0], minuteValues
[0],
101 secondValues
[i
], millisecondValues
[0]));
104 for (i
= 0; i
< millisecondValues
.length
; i
++) {
105 trace
("Date.UTC (" + yearValues
[0] + ", " + monthValues
[0] + ", " + dateValues
[0] + ", " +
106 hourValues
[0] + ", " + minuteValues
[0] + ", " + secondValues
[0] + ", " +
107 p
(millisecondValues
[i
]) + ")");
108 trace
(Date.UTC
(yearValues
[0], monthValues
[0], dateValues
[0], hourValues
[0], minuteValues
[0],
109 secondValues
[0], millisecondValues
[i
]));
114 for (i
= 0; i
< yearValues
.length
; i
++) {
115 // we can't test undefined first parameter, returns current time
116 if (typeof (yearValues
[i
]) == "undefined")
118 trace
("new Date (" + p
(yearValues
[i
]) + ")");
119 traced
(new Date (yearValues
[i
])); // Note: UTC here
120 trace
("new Date (" + p
(yearValues
[i
]) + ", " + monthValues
[0] + ", " + dateValues
[0] + ", " +
121 hourValues
[0] + ", " + minuteValues
[0] + ", " + secondValues
[0] + ", " +
122 millisecondValues
[0] + ")");
123 traced
(new Date (yearValues
[i
], monthValues
[0], dateValues
[0], hourValues
[0], minuteValues
[0],
124 secondValues
[0], millisecondValues
[0]));
127 for (i
= 0; i
< monthValues
.length
; i
++) {
128 trace
("new Date (" + yearValues
[0] + ", " + p
(monthValues
[i
]) + ")");
129 traced
(new Date (yearValues
[0], monthValues
[i
]));
130 trace
("new Date (" + yearValues
[0] + ", " + p
(monthValues
[i
]) + ", " + dateValues
[0] + ", " +
131 hourValues
[0] + ", " + minuteValues
[0] + ", " + secondValues
[0] + ", " +
132 millisecondValues
[0] + ")");
133 traced
(new Date (yearValues
[0], monthValues
[i
], dateValues
[0], hourValues
[0], minuteValues
[0],
134 secondValues
[0], millisecondValues
[0]));
137 for (i
= 0; i
< dateValues
.length
; i
++) {
138 trace
("new Date (" + yearValues
[0] + ", " + monthValues
[0] + ", " + p
(dateValues
[i
]) + ")");
139 traced
(new Date (yearValues
[0], monthValues
[0], dateValues
[i
]));
140 trace
("new Date (" + yearValues
[0] + ", " + monthValues
[0] + ", " + p
(dateValues
[i
]) + ", " +
141 hourValues
[0] + ", " + minuteValues
[0] + ", " + secondValues
[0] + ", " +
142 millisecondValues
[0] + ")");
143 traced
(new Date (yearValues
[0], monthValues
[0], dateValues
[i
], hourValues
[0], minuteValues
[0],
144 secondValues
[0], millisecondValues
[0]));
147 for (i
= 0; i
< hourValues
.length
; i
++) {
148 trace
("new Date (" + yearValues
[0] + ", " + monthValues
[0] + ", " + dateValues
[i
] + ", " +
149 p
(hourValues
[i
]) + ")");
150 traced
(new Date (yearValues
[0], monthValues
[0], dateValues
[0], hourValues
[i
]));
151 trace
("new Date (" + yearValues
[0] + ", " + monthValues
[0] + ", " + dateValues
[0] + ", " +
152 p
(hourValues
[i
]) + ", " + minuteValues
[0] + ", " + secondValues
[0] + ", " +
153 millisecondValues
[0] + ")");
154 traced
(new Date (yearValues
[0], monthValues
[0], dateValues
[0], hourValues
[i
], minuteValues
[0],
155 secondValues
[0], millisecondValues
[0]));
158 for (i
= 0; i
< minuteValues
.length
; i
++) {
159 trace
("new Date (" + yearValues
[0] + ", " + monthValues
[0] + ", " + dateValues
[i
] + ", " +
160 hourValues
[0] + ", " + p
(minuteValues
[i
]) + ")");
161 traced
(new Date (yearValues
[0], monthValues
[0], dateValues
[0], hourValues
[0], minuteValues
[i
]));
162 trace
("new Date (" + yearValues
[0] + ", " + monthValues
[0] + ", " + dateValues
[0] + ", " +
163 hourValues
[0] + ", " + p
(minuteValues
[i
]) + ", " + secondValues
[0] + ", " +
164 millisecondValues
[0] + ")");
165 traced
(new Date (yearValues
[0], monthValues
[0], dateValues
[0], hourValues
[0], minuteValues
[i
],
166 secondValues
[0], millisecondValues
[0]));
169 for (i
= 0; i
< secondValues
.length
; i
++) {
170 trace
("new Date (" + yearValues
[0] + ", " + monthValues
[0] + ", " + dateValues
[i
] + ", " +
171 hourValues
[0] + ", " + minuteValues
[0] + ", " + p
(secondValues
[i
]) + ")");
172 traced
(new Date (yearValues
[0], monthValues
[0], dateValues
[0], hourValues
[0], minuteValues
[0],
174 trace
("new Date (" + yearValues
[0] + ", " + monthValues
[0] + ", " + dateValues
[0] + ", " +
175 hourValues
[0] + ", " + minuteValues
[0] + ", " + p
(secondValues
[i
]) + ", " +
176 millisecondValues
[0] + ")");
177 traced
(new Date (yearValues
[0], monthValues
[0], dateValues
[0], hourValues
[0], minuteValues
[0],
178 secondValues
[i
], millisecondValues
[0]));
181 for (i
= 0; i
< millisecondValues
.length
; i
++) {
182 trace
("new Date (" + yearValues
[0] + ", " + monthValues
[0] + ", " + dateValues
[0] + ", " +
183 hourValues
[0] + ", " + minuteValues
[0] + ", " + secondValues
[0] + ", " +
184 p
(millisecondValues
[0]) + ")");
185 traced
(new Date (yearValues
[0], monthValues
[0], dateValues
[0], hourValues
[0], minuteValues
[0],
186 secondValues
[0], millisecondValues
[i
]));
192 function test_date
(num
)
195 return new Date (yearValues
[0], monthValues
[0], dateValues
[0],
196 hourValues
[0], minuteValues
[0], secondValues
[0], millisecondValues
[0]);
197 } else if (num
== 1) {
198 return new Date (2005, 8, 20, NaN);
199 } else if (num
== 2) {
200 return new Date (275762, 0, 1);
201 } else if (num
== 3) {
202 return new Date (1804, 3, 24);
204 return new Date (-40, 1, 5);
208 for (var num
= 0; num
< num_test_dates
; num
++) {
209 for (var i
= 0; i
< yearValues
.length
; i
++) {
210 var d
= test_date
(num
);
211 trace
("test_date (" + num
+ ").setYear (" + p
(yearValues
[i
]) + ")");
212 trace
(d
.setYear
(yearValues
[i
]));
217 for (var num
= 0; num
< num_test_dates
; num
++) {
218 for (var i
= 0; i
< monthValues
.length
; i
++) {
219 var d
= test_date
(num
);
220 trace
("test_date (" + num
+ ").setMonth (" + p
(monthValues
[i
]) + ")");
221 trace
(d
.setMonth
(monthValues
[i
]));
226 for (var num
= 0; num
< num_test_dates
; num
++) {
227 for (var i
= 0; i
< dateValues
.length
; i
++) {
228 var d
= test_date
(num
);
229 trace
("test_date (" + num
+ ").setDate (" + p
(dateValues
[i
]) + ")");
230 trace
(d
.setDate
(dateValues
[i
]));
235 for (var num
= 0; num
< num_test_dates
; num
++) {
236 for (var i
= 0; i
< hoursValues
.length
; i
++) {
237 var d
= test_date
(num
);
238 trace
("test_date (" + num
+ ").setHours (" + p
(hoursValues
[i
]) + ")");
239 trace
(d
.setHours
(hoursValues
[i
]));
244 for (var num
= 0; num
< num_test_dates
; num
++) {
245 for (var i
= 0; i
< minutesValues
.length
; i
++) {
246 var d
= test_date
(num
);
247 trace
("test_date (" + num
+ ").setMinutes (" + p
(minutesValues
[i
]) + ")");
248 trace
(d
.setMinutes
(minutesValues
[i
]));
253 for (var num
= 0; num
< num_test_dates
; num
++) {
254 for (var i
= 0; i
< secondsValues
.length
; i
++) {
255 var d
= test_date
(num
);
256 trace
("test_date (" + num
+ ").setSeconds (" + p
(secondsValues
[i
]) + ")");
257 trace
(d
.setSeconds
(secondsValues
[i
]));
262 for (var num
= 0; num
< num_test_dates
; num
++) {
263 for (var i
= 0; i
< millisecondsValues
.length
; i
++) {
264 var d
= test_date
(num
);
265 trace
("test_date (" + num
+ ").setMilliseconds (" + p
(millisecondsValues
[i
]) + ")");
266 trace
(d
.setMilliseconds
(millisecondsValues
[i
]));
271 loadMovie
("FSCommand:quit", "");