$startdate="2008-06-22 20:38:25"; 
$enddate="2008-06-29 21:38:49"; 

$diff=strtotime($enddate)-strtotime($startdate); 
echo "diff in seconds: $diff<br/>\n<br/>\n"; 

// immediately convert to days 
$temp=$diff/86400; // 60 sec/min*60 min/hr*24 hr/day=86400 sec/day 

// days 
$days=floor($temp); echo "days: $days<br/>\n"; $temp=24*($temp-$days); 
// hours 
$hours=floor($temp); echo "hours: $hours<br/>\n"; $temp=60*($temp-$hours); 
// minutes 
$minutes=floor($temp); echo "minutes: $minutes<br/>\n"; $temp=60*($temp-$minutes); 
// seconds 
$seconds=floor($temp); echo "seconds: $seconds<br/>\n<br/>\n"; 

echo "Result: {$days}d {$hours}h {$minutes}m {$seconds}s<br/>\n"; 
echo "Expected: 7d 0h 0m 0s<br/>\n"; 


echo "time isss".time();

echo   $date = date('Y-m-d H:i:s')";

?>
bunu fonksiyon haline getirirsen istediğin gibi kullanabilirsin.