function countdown($ymd) { $ymdparts = explode('-', $ymd); $count = mktime(0,0,0,$ymdparts[1],$ymdparts[2],$ymdparts[0]); $difference = $count - time(); $abs_difference = abs($difference); $days = floor($abs_difference/60/60/24); $hours = floor(($abs_difference - $days*60*60*24)/60/60); $minutes = floor(($abs_difference - $days*60*60*24 - $hours*60*60)/60); if($difference != $abs_difference){ return "It was $days days, $hours hours and $minutes minutes ago!"; } else { return "The celebration will commence in $days days!"; } } ?>