ajsuk Posted August 16, 2006 Share Posted August 16, 2006 Hey there, me again with another request. :)I'd like to build a special custom countdown timer. What makes it special (and more complicated :() is its not going to countdown to a specified event(time,date) as the 100's of other scripts out there do.Heres what i'd like it to do...Have 4 cycles of 4.5 Days(108 hours)Display how long it is to each new cycle start. - For example "2 Days, 8 hours and 5minutes until cycle#3"Somehow be able to reset/calibrate/specify the countdown and cycle if the webserver went down or something.This is continues btw... (except if the server goes down ofcourse;))I think thats everything... :oI'm guessing PHP is the way to go with this as we could still use the server to count with?Thanks a bunch for any help you can give! This ones kicking my backside. :D Quote Link to comment Share on other sites More sharing options...
trq Posted August 16, 2006 Share Posted August 16, 2006 Any sort of counter would be best implimented in javascript. Php runs on the server so you'd need to do a page refresh every second. Quote Link to comment Share on other sites More sharing options...
ajsuk Posted August 16, 2006 Author Share Posted August 16, 2006 Good point, I should of mentioned I don't care about it really acting as a live counter, just giving a static output when the page has been loaded would be fine. :) Quote Link to comment Share on other sites More sharing options...
brown2005 Posted August 16, 2006 Share Posted August 16, 2006 <?phpfunction formatetimestamp($until){ $now = time(); $difference = $until - $now; $days = floor($difference/86400); $difference = $difference - ($days*86400); $hours = floor($difference/3600); $difference = $difference - ($hours*3600); $minutes = floor($difference/60); $difference = $difference - ($minutes*60); $seconds = $difference; $output = "You have to wait $days Days, $hours Hours, $minutes Minutes and $seconds Seconds until this Day."; return $output;}//int mktime ( [int hour [, int minute [, int second [, int month [, int day [, int year [, int is_dst]]]]]]] )echo formatetimestamp(mktime(0,0,0,12,31,2006)); //output: e.g "You have to wait 162 Days, 4 Hours, 38 Minutes and 46 Seconds until this Day"?> Quote Link to comment Share on other sites More sharing options...
ajsuk Posted August 16, 2006 Author Share Posted August 16, 2006 This looks like one of the many standard countdown scripts for a specific date. (New year for example)Doesn't do what I'd like... Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.