3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?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'; }
Output for 4.3.0 - 7.1.0
$timediff more than 24 hours