获取时间:年、月、日、星期
ActionScript 2.0
onClipEvent (load) {
days = new Array('Sunday', 'Monday', 'Tuesday', 'Wednesday', 'thursday', 'Friday', 'Saturday', 'Sunday');//星期数组
months = new Array('January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December');//月份数组
timedate = new Date();
}
onClipEvent (enterFrame) {
hour = timedate.getHours();//小时
minutes = timedate.getMinutes();//分钟
seconds = timedate.getSeconds();//秒
todaydate = timedate.getDate();//日期
day = timedate.getDay();//星期几
dayname = days[day];
month = timedate.getMonth(); //月份数
monthname = months[month];
year = timedate.getFullYear();//完整年份数
if (length(hour) == 1) {
hour = "0"+hour;
}
if (length(minutes) == 1) {
minutes = "0"+minutes;
}
if (length(seconds) == 1) {
seconds = "0"+seconds;
}
if (length(todaydate) == 1) {
todaydate = "0"+todaydate;
}
currenttime = hour+":"+minutes+":"+seconds;
currentdate = todaydate+"/"+month+"/"+year;
fulldate = dayname+" "+todaydate+" "+monthname+" "+year;
delete timedate;
timedate = new Date();
}