Print the time an hour ago
$date = date('Y-m-d H:i:s', strtotime('-1 hour'));
echo 'John visited last ' . $date;
$date = date("Y-m-d H:i:s", time() - 3600);
time() -> Current timestamp
Time minus 3600 seconds, is the time 1 hour ago. To get the date formatted, you can look here for the options: http://php.net/manual/en/function.date.php
Alternatively you could use the following format:
$date = date("Y-m-d H:i:s", strtotime('-1 hour'));
Though using that method can be a little clunky if you want to remove more specific units of time (Such as one day and 3 hours).
Thats if I've understood what you want to do correctly that is.