Jquery college entrance examination countdown

// First import the Jquery file
<span id="timestr"><span>
<script type="text/javascript">
    // var scount = 0;
    $(function () {
      var start = setInterval(function () {
        var dtstr = "";
        var now = new Date(); //Initialize the current time
        var newdatr = new Date(now.getFullYear(), "05", "07", "00", "00", "00", "00");//Initialize the target time (05 here is actually six moon)
        var nowhms = now.getTime(); //Convert the current time to milliseconds
        var newhms = newdatr.getTime(); // target time conversion milliseconds
        var cha = newhms - nothms; // time difference (milliseconds)
        if (cha > 0) {
          var day = parseInt(cha / (1000 * 60 * 60 * 24));//Calculate the number of days
          var hh = parseInt((cha % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));//Calculate hours
          var min = parseInt(((cha % (1000 * 60 * 60 * 24)) % (1000 * 60 * 60)) / (1000 * 60));//Calculate minutes
          var ss = parseInt((((cha % (1000 * 60 * 60 * 24)) % (1000 * 60 * 60)) % (1000 * 60)) / 1000);//Calculate seconds
          /*if (ss == 0) {
            count += 1;
          }*/
          // var ms = parseInt ((((cha% (1000 * 60 * 60 * 24))% (1000 * 60 * 60))% (1000 * 60))% 1000);
          dtstr = day + "day" + hh + "hour" + min + "minute" + ss + "second";
        }
        $("#timestr").html(dtstr);
      }, 1000);
    });
</script>

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324907227&siteId=291194637