倒计时flash时间总差31天...

来源:百度知道 编辑:UC知道 时间:2024/06/30 13:03:01
我做了一个2010 1月15号日环食的倒计时flash,但是时间总是差31天,请各位大侠帮忙分析。。。谢谢!
一下是我第一帧动作的代码:
EndTime=new Date(2010,01,15,15,32,0);
NowTime=new Date();
sectime=Math.floor((EndTime.getTime()-NowTime.getTime())/1000);
if(sectime>0)
{
dayt=Math.floor(sectime/(60*60*24));
sectime=sectime-dayt*60*60*24;
hourt=Math.floor(sectime/(60*60));

sectime=sectime-hourt*60*60;
mint=Math.floor(sectime/60);

sectime=sectime-mint*60;
sect=sectime;

day=String(dayt);
hour=String(hourt);
min=String(mint);
sec=String(sect);
}

EndTime=new Date(2010,01,15,15,32,0);
可能你没搞明白~`
你这个的时间是指:2010年2月15日15时32分0秒

在FLASH里面,月份的指示是0-11,0就相当于现实中的1月份,11则是指12月,你把时间01改为00应该就可以了

function aoyuntimelist() {
nowdate = new Date();
//创建新的日期对象,用来获取现在的时间
year = nowdate.getFullYear();
//获取当前的年份
month = nowdate.getMonth()+1;
//获取当前的月份,因为数组从0开始用0-11表示1-12月,所以要加1
date = nowdate.getDate();
//获取当前日期
day = nowdate.getDay();
//获取当年的星期
hour = nowdate.getHours();
//获取当前小时
minute = nowdate.getMinutes();
//获取当前的分钟
second = nowdate.getSeconds();
//获取当前的秒钟
enddate = new Date(2009, 1, 22, 20, 0, 0);
//创建新的日期对象,并初始化结束时间 虽然是8月8号 但是月份是从零开始的 所以因该是7
shijiancha = (enddate.getTime()-nowdate.getTime())/1000;
//时间差,本来是以毫秒为单位,除以1000后,就以秒为单位
if (shijiancha>=0) {
//判断倒计时是否过期。
shengyutian = Math.floor(shijiancha/(3600*24));
//单位zhuan
shengyuxiaoshi = Math.floor((shijiancha-shen