title: 24 hour Countdown timer using Javascript and PHP
body: <p>I need a 24 hour countdown timer like the image in the link. I need to implement the timer to my wordpress site. The timer should reset every night at midnight EST. </p>
  
  <p>This is my current JS Code but it restarts each time i refresh the page. Can I somehow integrate it with EST?</p>
  
  <pre><code>    &lt;script type = "text/javascript"&gt;
  
  var timeInSecs;
  var ticker;
  
  function startTimer(secs) {
  timeInSecs = parseInt(secs);
  ticker = setInterval("tick()", 1000); 
  }
  
  function tick( ) {
  var secs = timeInSecs;
  if (secs &gt; 0) {
  timeInSecs--; 
  }
  else {
  clearInterval(ticker);
  startTimer(172800);  // start again
  }
  
  var hours= Math.floor(secs/3600);
  secs %= 3600;
  var mins = Math.floor(secs/60);
  secs %= 60;
  var pretty = ( (hours &lt; 10 ) ? "0" : "" ) + hours + ":" + ( (mins &lt; 10) ? "0" : "" ) + mins + ":" + ( (secs &lt; 10) ? "0" : "" ) + secs;
  document.getElementById("countdown").innerHTML = pretty;
  }
  
  startTimer(86400);  // 24 hours in seconds
  
  &lt;/script&gt;
  
  &lt;span id="countdown" style="font-weight: bold;"&gt;&lt;/span&gt;
  </code></pre>