3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php // your first date coming from a mysql database (date fields) $dateA = '2013-11-11 23:10:30'; // 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 'more than 24 hours'; } else { echo 'less than 24 hours'; }
Output for 4.3.0 - 7.1.0
less than 24 hours