3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $sStartDate = DateTime::createFromFormat('Y-m-d H:i:s', '2013-05-13 21:56:00'); $sEndDate = DateTime::createFromFormat('Y-m-d H:i:s', '2013-05-14 21:56:01'); $diff = date_diff($sStartDate, $sEndDate, true); $days = $diff->format('%a'); if (1 <= $days) { echo '24 hours or more.'; } else { echo 'less than 24 hours.'; }
Output for 5.3.21 - 7.2.6
24 hours or more.