<?php $dates = array('2019-03-20 00:00:00', '2019-03-20 02:30:00', '2019-03-20 05:00:00', '2019-03-20 14:30:00', '2019-03-20 23:59:59'); $now = date('Y-m-d H:i:s'); $latest = ''; foreach ($dates as $date) { if ($date > $now) break; $latest = $date; } echo $latest;
You have javascript disabled. You will not be able to edit any code.