- date: documentation ( source)
- strtotime: documentation ( source)
<?php
// your first date coming from a mysql database (date fields)
$dateA = date('Y-m-d H:i:s');
// your second date coming from a mysql database (date fields)
$dateB = '2013-11-11 16:27:21';
$timediff = strtotime($dateA) - strtotime($dateB);
if($timediff > 86400){
echo "$timediff more than 24 hours";
}
else
{
echo 'less than 24 hours';
}