HTML <div class="countDown"> <span id=" countle-day ">00</span> Days <span id=" countle-hour ">00</span> When <span Id =" countdown-minute ">00</span> minutes <span id=" countdown-second ">00</span> seconds </div> js code var month=new Date().getMonth()+1;  var year=new Date().getFullYear(); var date = new Date(year,month,0); var endTime = year + '/' + month + '/' + new Date(date).getDate() + ' 23:59:59'; var _ordertimer = setInterval(function(){ countDownFun(endTime) }, 1000); function countDownFun(val){ var leftTime = new Date(val) - new Date(); Var days = parseInt(leftTime / 1000/60/60/24, 10); Var hours = parseInt(leftTime / 1000/60/60/24, 10); var hours = parseInt(leftTime / 1000/60/60/24, 10); Var minutes = parseInt(leftTime / 1000/60/60, 10); Var seconds = parseInt(leftTime / 1000%60, 10); // Calculate the remaining seconds days = checkTime(days); hours = checkTime(hours); minutes = checkTime(minutes); seconds = checkTime(seconds); if (parseInt(leftTime/1000) < 0) { clearInterval(_ordertimer) }else{ $("#countDown-day").html(days) $("#countDown-hour").html(hours) $("#countDown-minute").html(minutes) $("#countDown-second").html(seconds) } } function If (I <10) {I = "0" + I; if(I <10) {I = "0" + I; } return i; }Copy the code