我想在flash中加入一个显示和过去时间相减的天数
例如,你已经离开了 天
我的代码有问题么
myDate = new Date();
mnow = myDate.getMonth();
dnow = myDate.getDate();
ynow = myDate.getFullYear();
dpas = 1;
ypas = 2006;
mpas = 4;
timenow = (mnow+"/"+dnow+"/"+ynow);
timepast = (mpas+"/"+dpas+"/"+ypas);
timeno = ((ynow-ypas)*365+(mnow-mpas)*31+(dnow-dpas));
这个是从网上找的 不过要查在哪啊? 还需要弄写什么 ? 这个是什么元件的脚本 请好心人教下````
我想在flash中加入一个显示和过去时间相减的天数
答案:1 悬赏:10 手机版
解决时间 2021-02-18 11:45
- 提问者网友:蔚蓝的太阳
- 2021-02-18 05:18
最佳答案
- 五星知识达人网友:神鬼未生
- 2021-02-18 06:45
function aoyuntimelist() {
nowdate = new Date();
year = nowdate.getFullYear();
month = nowdate.getMonth()+1;
date = nowdate.getDate();
day = nowdate.getDay();
hour = nowdate.getHours();
minute = nowdate.getMinutes();
second = nowdate.getSeconds();
enddate = new Date(2007, 9, 1, 14, 48, 30);
shijiancha = (nowdate.getTime()-enddate.getTime())/1000;
if (shijiancha>=0) {
shengyutian = Math.floor(shijiancha/(3600*24));
shengyuxiaoshi = Math.floor((shijiancha-shengyutian*24*3600)/3600);
shengyufen = Math.floor((shijiancha-shengyutian*24*3600-shengyuxiaoshi*3600)/60);
shengyumiao = Math.floor(shijiancha-shengyutian*24*3600-shengyuxiaoshi*3600-shengyufen*60);
if (month<10) {
month = "0"+month;
}
if (date<10) {
date = "0"+date;
}
if (hour<10) {
hour = "0"+hour;
}
if (minute<10) {
minute = "0"+minute;
}
if (second<10) {
second = "0"+second;
}
if (shengyutian<10) {
shengyutian = "0"+shengyutian;
}
if (shengyuxiaoshi<10) {
shengyuxiaoshi = "0"+shengyuxiaoshi;
}
if (shengyufen<10) {
shengyufen = "0"+shengyufen;
}
if (shengyumiao<10) {
shengyumiao = "0"+shengyumiao;
}
outtime1 = “你已经离开了"+String(shengyutian)+"天"+String(shengyuxiaoshi)+"时"+String(shengyufen)+"分"+String(shengyumiao)+"秒";
}
}
setInterval(aoyuntimelist, 1000);
nowdate = new Date();
year = nowdate.getFullYear();
month = nowdate.getMonth()+1;
date = nowdate.getDate();
day = nowdate.getDay();
hour = nowdate.getHours();
minute = nowdate.getMinutes();
second = nowdate.getSeconds();
enddate = new Date(2007, 9, 1, 14, 48, 30);
shijiancha = (nowdate.getTime()-enddate.getTime())/1000;
if (shijiancha>=0) {
shengyutian = Math.floor(shijiancha/(3600*24));
shengyuxiaoshi = Math.floor((shijiancha-shengyutian*24*3600)/3600);
shengyufen = Math.floor((shijiancha-shengyutian*24*3600-shengyuxiaoshi*3600)/60);
shengyumiao = Math.floor(shijiancha-shengyutian*24*3600-shengyuxiaoshi*3600-shengyufen*60);
if (month<10) {
month = "0"+month;
}
if (date<10) {
date = "0"+date;
}
if (hour<10) {
hour = "0"+hour;
}
if (minute<10) {
minute = "0"+minute;
}
if (second<10) {
second = "0"+second;
}
if (shengyutian<10) {
shengyutian = "0"+shengyutian;
}
if (shengyuxiaoshi<10) {
shengyuxiaoshi = "0"+shengyuxiaoshi;
}
if (shengyufen<10) {
shengyufen = "0"+shengyufen;
}
if (shengyumiao<10) {
shengyumiao = "0"+shengyumiao;
}
outtime1 = “你已经离开了"+String(shengyutian)+"天"+String(shengyuxiaoshi)+"时"+String(shengyufen)+"分"+String(shengyumiao)+"秒";
}
}
setInterval(aoyuntimelist, 1000);
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯