Problem with calculating time since visit


I’ve used a function to calculate how long since a user visited a page…it’s been working great until recently. We’ve done some changes in our server’s offset timezone settings…not sure if it’s related or not…

But what happens is…when it’s supposed to echo 1minute ago or 0 minutes ago…it gives: 23 hours 59 minutes ago…

This is the code I’ve been using:
(Each time the user visits the page it’s inserted to a database table…then we select this table…the dateformat from the database is yyyy-mm-dd H:i:s )
$date1 = time();

$content .= ‘

foreach( $data as $row )
			$user1  = CFactory::getUser( $row->visitor_userid );
			$date2 = strtotime($row->date);
			$dateDiff = $date1 - $date2;
			$fullDays = floor($dateDiff/(60*60*24));
			$fullHours = floor(($dateDiff-($fullDays*60*60*24))/(60*60));
			$fullMinutes = floor(($dateDiff-($fullDays*60*60*24)-($fullHours*60*60))/60);


Then i just run a switch to give the text output on how long since the users visit this page.

Any help would be greatly appriciated :confused:

Sponsor our Newsletter | Privacy Policy | Terms of Service