I\'m trying to make something like this:
if (datetime - system date > 15 minutes) (false)
if (datetime - system date
If your dates are already in MySQL you will want to do the comparison in the query because:
Below is the most efficient form. If there is an index on the date
column it will be used.
SELECT *
FROM table
WHERE date > DATE_SUB(NOW(), INTERVAL 15 MINUTE)
Docs: DATE_SUB()
If you need to do it in PHP:
$now = time();
$target = strtotime($date_from_db);
$diff = $now - $target;
if ( $diff > 900 ) {
// something
}
or, more succinctly:
if( time() - strtotime($date_from_db) > 900 ) {
// something
}