jQ 倒计时(天)

function mygoalTime(inputTime) {
            var starttime = new Date(inputTime);
            setInterval(function () {
                var nowtime = new Date();
                var time = starttime - nowtime;
                var day = Math.ceil(time / 1000 / 60 / 60 / 24);
                if ((time / 1000 / 60 / 60 / 24) > 0 && (time / 1000 / 60 / 60 / 24) < 1) {
                    day = Math.ceil(1);
                }
                else if ((time / 1000 / 60 / 60 / 24) <= 0) {
                    day = parseInt(0);
                }

                var dateText = [];
                for(var n = 0;n 2) {
                    // dateText = dateText.slice(dateText.length - 2,dateText.length);
                    dateText = [9,9];
                }
                $('.time-box .left').text(dateText[0]);
                $('.time-box .right').text(dateText[1]);
        }, 86400000);
}

你可能感兴趣的:(jQ 倒计时(天))