function formatNum(n){
if(n>9) {
return ''+n;
}else{
return '0'+n;
}
}
function times(){
var enddate=new Date('2020/08/23 00:00:00');
var mydate=new Date();
var strTimes='';
var t=enddate.getTime()-mydate.getTime();
strTimes=formatNum(Math.floor(t/1000/60/60/24))+":"+formatNum(Math.floor(t/1000/60/60%24))+":"+formatNum(Math.floor(t/1000/60%60))+":"+formatNum(Math.floor(t/1000%60));
console.log(strTimes)
}
setInterval(times,1000);
js活动距离倒计时
最新推荐文章于 2022-04-15 20:30:55 发布