Greetings:
I am building an advanced countdown timer and am currently stuck in the following bit:
Basically what it 'did' in javascript was to get now's date with date(); every second with the use of the SetTimeOut function. However, for reliability, I was forced to adjust the timer to the server's clock using PHP's date("format");
The problem is now that every time JS tries to recalculate the time, my PHP date values are static and the clock doesn't tick anymore. So I've been searching for PHP's alternate version of JavaScript's SetTimeOut which would ultimately allow me the recalculation of the 'forced' values =)
Thanks in advance
I am building an advanced countdown timer and am currently stuck in the following bit:
Basically what it 'did' in javascript was to get now's date with date(); every second with the use of the SetTimeOut function. However, for reliability, I was forced to adjust the timer to the server's clock using PHP's date("format");
The problem is now that every time JS tries to recalculate the time, my PHP date values are static and the clock doesn't tick anymore. So I've been searching for PHP's alternate version of JavaScript's SetTimeOut which would ultimately allow me the recalculation of the 'forced' values =)
Code:
function GetCount()
dateFuture = new Date(2007,7,10,2,0,0);
dateNow = new Date(2007,7,10,1,0,0); //Here is where I inserted the <?php ?> tags with the static values
amount = dateFuture.getTime() - dateNow.getTime();
delete dateNow;
days=0;hours=0;mins=0;secs=0;out="";
amount = Math.floor(amount/1000);
hours=Math.floor(amount/3600);
amount=amount%3600;
mins=Math.floor(amount/60);
amount=amount%60;
secs=Math.floor(amount);
out += "Next Match In: ";
if(days != 0 || hours != 0){out += ((hours<10)?"0":"") + hours + ":";}
if(days != 0 || hours != 0 || mins != 0){out += ((mins<10)?"0":"") + mins + ":";}
out += ((secs<10)?"0":"") + secs + " EST";
document.getElementById('countbox').innerHTML=out;
setTimeout("GetCount()", 1000);