I am trying to figure out what is the best way to
date('Y-m-d H:i:s') best?)I'm a newbie at php.
Pull the date you wanted from MySQL
SELECT myDateCol FROM myTable WHERE ...
Convert this into a UNIX timestamp
$db_timestamp = strtotime($db_row['myDateCol']);
Check if the date from the DB is within the last 5 hours
if ($db_timestamp >= strtotime('-5 hours')) echo 'DB date is within last 5 hours';
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With