function elapsed_time ( $start, $end = false) { if ($end == false) //if you don't pass a second parameter, $end = time(); //we assume you're comparing to now. $diff = $end - $start; $days = floor ( $diff/86400 ); //calculate the days $diff = $diff - ($days*86400); // subtract the days $hours = floor ( $diff/3600 ); // calculate the hours $diff = $diff - ($hours*3600); // subtract the hours $mins = floor ( $diff/60 ); // calculate the minutes $diff = $diff - ($mins*60); // subtract the mins $secs = $diff; // what's left is the seconds; if ($secs > 0) { $returnval = "$secs second".(($secs>1) ? "s":"")." ago"; } if ($mins > 0) { $returnval = "$mins minute".(($mins>1) ? "s":"")." ago"; } if ($hours > 0) { $returnval = "$hours hour".(($hours>1) ? "s":"")." ago"; } if ($days > 0) { $returnval = "$days day".(($days>1) ? "s":"")." ago"; } $return = "About "; //change the wording to what you like return $return . $returnval; }