Jquery之倒计时计算

 
 setInterval("setDate('2018-12-24 12:20:45')",);

 function setDate(setTime){
var date = new Date();//获取系统当前时间
var time = (date.getYear()+)+"-"+(date.getMonth()+)+"-"+date.getDate() +" "+date.getHours()+":"+date.getMinutes()+":"+date.getSeconds();
var setDate = new Date(setTime);
var leftTime = setDate.getTime()- date.getTime();
/* var Day = parseInt(dg/86400000);
var hg = dg - Day*86400000;
var Hours = parseInt(hg/3600000);;
var mg = hg - Hours*3600000;
var Minutes = parseInt(mg/60000);
var sg = mg - Minutes*60000;
var s = parseInt(sg/1000);
var dTime = Day + " 天 "+Hours + " 时 "+Minutes + " 分 "+s + " 秒 ";*/ var d,h,m,s;
if (leftTime>=) {
d = Math.floor(leftTime////);
h = Math.floor(leftTime///%);
m = Math.floor(leftTime//%);
s = Math.floor(leftTime/%);
}
var dTime = d + " 天 "+h + " 时 "+m + " 分 "+s + " 秒 "; //$("#time").html("倒计时:"+dTime);
}
 
上一篇:改变HTML


下一篇:构建ASP.NET MVC4+EF5+EasyUI+Unity2.x注入的后台管理系统(40)-精准在线人数统计实现-【过滤器+Cache】