var timeout = setInterval(() => {
var laterDate = new Date(finishTime).getTime()
var nowDate = new Date().getTime()
var time = laterDate - nowDate
if (time <= 0) {
timeShop()
}
var time2 = formatDuring(time)
$('.finishTime').html(time2)
}, 1000)
function timeShop() {
clearInterval(timeout)
}
function formatDuring(mss) {
var days = parseInt(mss / (1000 * 60 * 60 * 24));
var hours = parseInt((mss % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
var minutes = parseInt((mss % (1000 * 60 * 60)) / (1000 * 60));
var seconds = ((mss % (1000 * 60)) / 1000).toFixed(0);
return days + " 天 " + hours + " 小时 " + minutes + " 分钟 " + seconds + " 秒 ";
}
天/时/分/秒倒计时
最新推荐文章于 2023-12-02 09:37:15 发布