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倒计时
网站URL:http://scyanting.com/article/jdohje.html