Zmodyfikowałem sobie licznik odliczający czas online do danej daty.
licznik działa oki ale chciałem aby zamiast samych godzin przeliczał i pokazywał też ile dni i coś spieprzyłem chyba bo nadal pokazuje tylko godziny jakieś pomysły na js się nie znam za bardzo więc proszę o pomoc.
<script type="text/javascript"> $(document).ready(function() {
var currenttime = '{ENDS_IN}';
function padlength(what)
{
var output=(what.toString().length == 1)? '0' + what : what;
return output;
}
function displaytime()
{
currenttime -= 1;
if (currenttime > 0){
var dni = Math.floor(currenttime / 86400);
var hours = Math.floor((currenttime - (dni * 86400)) / 24);
var mins = Math.floor((currenttime - (dni * 86400) - (hours * 3600)) / 60);
var secs = Math.floor(currenttime - (dni * 86400) - (hours * 3600) - (mins * 60));
var timestring = padlength(dni) + ':' padlength(hours) + ':' + padlength(mins) + ':' + padlength(secs);
$("#ending_counter").html(timestring);
setTimeout(displaytime, 1000);
} else {
$("#ending_counter").html('
<span class="errfont">{L_911}
</span>');
}
}
setTimeout(displaytime, 1000);
});