M
M
mrzgt2018-01-31 16:01:14
JavaScript
mrzgt, 2018-01-31 16:01:14

How to change the timer so that it resets every 3 days?

function get_timer() {
      var timeend= new Date();
      timeend = new Date(<?php echo $date_out; ?>);
      var day = new Date();
      day.setMonth(day.getMonth() + 1);
      day = Math.floor((timeend-day)/1000);
      var sec=day%60; day=Math.floor(day/60);
      var min=day%60; day=Math.floor(day/60);
      var hour=day%24; day=Math.floor(day/24);
      if(day<10)day='0'+day;
      if(hour<10)hour='0'+hour;
      if(min<10)min='0'+min;
      if(sec<10)sec='0'+sec;
      var timestr =  "<span class='special-timer-info'>" +day+  "<span class='special-timer-text'><?php echo $day; ?></span></span><span class='special-timer-line'>&ndash;</span><span class='special-timer-info'>"  +hour+    "<span class='special-timer-text'><?php echo $hour; ?></span></span><span class='special-timer-line'>&ndash;</span><span class='special-timer-info'>"  +min+   "<span class='special-timer-text'><?php echo $minute; ?></span></span><span class='special-timer-line'>&ndash;</span><span class='special-timer-info'>"   +sec+   "<span class='special-timer-text'><?php echo $second; ?></span></span>";
      document.getElementById('time_out').innerHTML=timestr;
      setTimeout(get_timer,1000);
    }
    get_timer()

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question