Pull the date you want from MySQL
SELECT myDateCol FROM myTable WHERE ...
Convert this to a UNIX timestamp
$db_timestamp = strtotime($db_row['myDateCol']);
Check if the date from the database for the last 5 hours is indicated.
if ($db_timestamp >= strtotime('-5 hours')) echo 'DB date is within last 5 hours';
pix0r source
share