星期一, 三月 12, 2007

flash中的Date对象


Date 对象主要有两种创建方法,一种是通过指定时间创建一个 Date 对象的实例,这
时至少要用到 year和 month两个参数,如下所示:
myDate = new Date(2003, 7, 8, 13, 16, 500);
另一种方法是通过获取系统时间创建一个Date对象的实例,这时不指定任何参数,如
下所示:
myDate = new Date();
创建Date对象后即可使用 Date对象的方法。如下所示:
myDate= new Date();
year = myDate.getYear();
fullyear = myDate.getFullYear();
month = myDate.getMonth();
dates = myDate.getDate();
hour = myDate.getHours();
minute = myDate.getMinutes();
second = myDate.getSeconds();
millisecond = myDate.getMilliseconds();
day = myDate.getDay();
time = myDate.getTime();
trace(year+","+fullyear+","+month+","+dates+","+hour+","+minute+","+second+","+millis
econd+","+day+","+time);

没有评论: