• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

countdown - event / restart ...

PuszekLDZ

https://tibia74.eu
Premium User
Joined
Jan 2, 2020
Messages
329
Solutions
1
Reaction score
85
Location
Lodz
Hi.. i found a event countdown timer:

JavaScript:
setInterval(function time(){
  var d = new Date();
  var hours = 24 - d.getHours();
  var min = 60 - d.getMinutes();
  if((min + '').length == 1){
    min = '0' + min;
  }
  var sec = 60 - d.getSeconds();
  if((sec + '').length == 1){
        sec = '0' + sec;
  }
  jQuery('#the-final-countdown p').html(hours+':'+min+':'+sec)
}, 1000);

but when i change h and min it counts - ....

i want to do a countdown to server rester to web page (just as info)
i lookin it for counting to 06:00:00 and restart (06:00:00 is serwer restart time)

is that code good? what to change in it?
 
ok, I got new script.. it counts for 30min and restart counting
how to chage it to counting for more time?
JavaScript:
<script>
 function addZero(i)
{
if (i<10)
  {
   i="0" + i;
  }
 return i;
 }
 setInterval(function() {
   function addZero(i)
{
if (i<10)
  {
  i="0" + i;
  }
return i;
}
    var d = new Date();
    var s =(d.getSeconds());
    var m =(d.getMinutes());
    var x = document.getElementById("timer");
    var c = addZero(30 - m) + ":" + addZero(59 - s);
    var d = addZero(59 - m) + ":" + addZero(59 - s);
    if (m < 30) {
        t = c
    }
    else {
        t = d
    }

     x.innerHTML = t;
 }, 250)
    </script>
 
Back
Top