Posted on: 09/23/05 01:43pm
By: Anonymous (Jeremy1701)
Posted on: 12/05/05 03:44pm
By: Anonymous (Shan)
Posted on: 12/05/05 04:29pm
By: machinari
function phpblock_countdown(){ // Change the Dates to meet your needs $day = 23; // Day of the countdown $month = 8; // Month of the countdown $year = 2004; // Year of the countdown $retval = ('There are ' . (int)((mktime (0,0,0,$month,$day,$year) - time(void))/86400) . ' days left \'til the <i>insert event here</i> goes online'); return $retval; }
Posted on: 02/01/06 08:39am
By: 1000ideen
Posted on: 02/02/06 11:10pm
By: machinari
$timeLeft = ((int)(mktime ($hour,$minute,$second,$month,$day,$year) - time(void)); if ($timeLeft <= 0) { $retval = 'The <i>insert event here</i> is now playing!'; } else { $retval = 'There are ' . $timeLeft . ' seconds left until the <i>insert event here</i> goes online'); } return $retval;with a bit of math you can change $timeLeft into years, months, days, etc.
Posted on: 02/02/06 11:12pm
By: machinari
Posted on: 02/03/06 05:53am
By: 1000ideen
function phpblock_podcastcountdown() { global $LANG01, $LANG_WHATSNEW; // find stories in topic e.g. "podcast" with future date, compare if this date is in the future or present time plus 1 hour. Iif there are more than 1 stories choose the next story, if there is no story then don't activate block //end of countdown = story_date $countdown_end = {story_date}; // countdown event = story_title $countdown_event = till the next podcast: {story_title}; $text_on_countdown_event = The podcast is on! $retval .= ' '; $now = strtotime ("now"); $then = strtotime ("$countdown_end"); $difference = $then - $now; $num = $difference/86400; $days = intval($num); $num2 = ($num - $days)*24; $hours = intval($num2); $num3 = ($num2 - $hours)*60; $mins = intval($num3); $num4 = ($num3 - $mins)*60; $secs = intval($num4); if ($days>0 || $hours>0 || $minutes>0 || $seconds>0) { $retval = $days . $LANG_WHATSNEW[days]'' . $hours . $LANG_WHATSNEW[hours]' ' . $mins . $LANG_WHATSNEW[minutes]' <br>' . $secs . $LANG01[92]' ' . $countdown_event; } else if (($days==0) && ($hours==0 || $minutes<=0 || $seconds<=0)) { $retval .= $text_on_countdown_event; } else { //deactivate block! } return $retval; } ?>
Posted on: 07/19/07 12:52pm
By: ofey
Posted on: 11/11/07 12:10am
By: Anonymous (Wal)
Rather than the countdown just be accurate at the time of loading the page is it possible that the countdown timer, actually counts down as you look at it in real time. In other words is there some way to actually constantly refresh it?
Shane
Posted on: 11/11/07 05:31am
By: ofey
Posted on: 11/11/07 08:07pm
By: Anonymous (Wal)
Thanks Wal for the code. But how would you change the code to count only in second or only in days a or whatever?
Shane
Posted on: 11/12/07 03:52am
By: ofey