title: How to get server time every seconds
body: <p>My question is Client time only displayed, But want to display server time every seconds.</p>
  
  <pre><code>function GetCount(ddate,iid){
  
  var date = new Date();
  dateNow = date;
  
  // if time is already past
  if(amount &lt; 0){
  
  }
  // else date is still good
  else{
      days=0;hours=0;mins=0;secs=0;out="";
  
      amount = Math.floor(amount/1000);//kill the "milliseconds" so just secs
  
      days=Math.floor(amount/86400);//days
      amount=amount%86400;
  
      hours=Math.floor(amount/3600);//hours
      amount=amount%3600;
  
      mins=Math.floor(amount/60);//minutes
      amount=amount%60;
  
      secs=Math.floor(amount);//seconds
  
      document.getElementById(iid).innerHTML=days;
      document.getElementById('countbox1').innerHTML=hours;
      document.getElementById('countbox2').innerHTML=mins;
      document.getElementById('countbox3').innerHTML=secs;
  
      setTimeout(function(){GetCount(ddate,iid)}, 1000);
  }
  }
  </code></pre>