function approx_date_diff ($date1, $date2
{
$times = array
'year' => round(365.2425 * 86400),
'month' => round(365.2425 * 86400 / 12),
'week' => 7 * 86400,
'day' => 86400,
'hour' => 3600,
'minute' => 60,
'second' => 1,
);
$diff = abs$date1 - $date2);
$str = '0 seconds'
foreach ($times as $unit => $secs) {
$num = $diff$secs
if ($num>=1) {
$num = round$num);
if ($num>=2) $unit .= 's'
$str = "$num $unit"
break
}
}
return $str
}