JS倒计时
var now = new Date();
var end = new Date("Jun 17,2017 00:00:00");
function getTime(now, end){
var time=Math.floor((end-now)/1000);//转化单位为秒。
var day=Math.floor(time/86400);//1天86400秒;
var hour =Math.floor(time%86400/3600);//1小时3600秒;
var minute=Math.floor(time%3600/60);
var second=Math.floor(time%60);
return "还剩下"+day+"天"+hour+"小时"+minute+"分"+second+"秒";
}
分享文章:JS倒计时
文章转载:http://myzitong.com/article/jdohje.html