Here is simple PHP code to check the time between two times.
<?php $current_time = date('H:i'); $startTime = "09:15"; $endTime = "09:45"; $time1 = DateTime::createFromFormat('H:i', $current_time); $time2 = DateTime::createFromFormat('H:i', $startTime); $time3 = DateTime::createFromFormat('H:i', $endTime); if ($time1 >= $time2 && $time1 <= $time3){ echo true; }else{ echo false; }
For this I’m using DateTime::createFromFormat you can read more about DateTime here.