makka Posted April 23, 2007 Share Posted April 23, 2007 hello i need a count down timer that needs to be precise to the second iff possible it will run over 3 days down to a advent so multiple users can look at the timer and tell when it will happen so every one can do something at the same time Link to comment https://forums.phpfreaks.com/topic/48336-solved-count-down-timer-needs-to-be-in-the-second/ Share on other sites More sharing options...
arianhojat Posted April 23, 2007 Share Posted April 23, 2007 u could do soemthing like $countDownTo = strtotime('2008-1-1 00:00:00');//count down to this time $now = mktime();//current time $secondsTill = $countDownTo-$now; //seconds till that time if($secondsTill > 0) { //add javascript code to the page that updates a div ever second with setTimeout function. It will initially literally be given that php $secondsTill value so it subtracts 1 from it every second in that setTimeout function. } else { //write html code saying time is passed, so past by -$secondsTill seconds. } or u could use an AJAX call every second, but u already know the time will be 1 second less each time, no need to wait for Ajax request, just do it in simple javascript. Link to comment https://forums.phpfreaks.com/topic/48336-solved-count-down-timer-needs-to-be-in-the-second/#findComment-236324 Share on other sites More sharing options...
makka Posted April 23, 2007 Author Share Posted April 23, 2007 would you give me the js? i hate js!! Link to comment https://forums.phpfreaks.com/topic/48336-solved-count-down-timer-needs-to-be-in-the-second/#findComment-236326 Share on other sites More sharing options...
makka Posted April 23, 2007 Author Share Posted April 23, 2007 $countDownTo = strtotime('2007-4-23 23:00:00');//count down to this time is this 9pm gmt? today Link to comment https://forums.phpfreaks.com/topic/48336-solved-count-down-timer-needs-to-be-in-the-second/#findComment-236342 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.