Here is a small idea of mine, how to do that, this function will return you the difference between the times IN SECONDS, all you have to do, is convert this to whatever value you need:
the trick is to get NOT THE VALUES RETURNED BY DATE() but VALUES RETURNED BY TIME()... and simply get the difference between the two timestamps...
<?
//$logout and $login are timestamps obtained either with time() or mktime()
function timeDiff($logout,$login){
$toreturn = $logout - $login;
return $toreturn;
}
//to get something nice out of this time, u do this
function makeItNice($temp){
$secondsleft = $temp % 60;
$minutes = round($temp / 60);
$minutesleft = $minutes % 60;
$hours = round($minutes / 60);
$hoursleft = $hours % 24;
$days = round($hours / 60);
$toreturn = $days . " days and " . hoursleft . ":" . $minutesleft . ":" . $secondsleft;
return $toreturn;
}
?>