如何防止接受来自数据库的两个时间(h:i)值之间的值

if(($eventtime3 > $eventtime1) && ($eventtime3 < $eventtime2))
    {
    $errors = '<p style="color:red">Sorry, the date <b>'.$date.'</b> and time <b>'.$timein.'</b> is between a time that is already reserved. Thanks.</p>';
    }

sorry beginner here in this site. im trying to put a restriction in a time input from a reservation module in my website

as you can see in the image below my reservation module is accepting the time input even if it is in between the time in and time out values

here's an image to further explain it here's an image to further explain it

i tried to convert the string value of time from my database to this

$eventDate1 = DateTime::createFromFormat("h:i", "$tin");
$eventDate2 = DateTime::createFromFormat("h:i", "$tout");
$eventDate3 = DateTime::createFromFormat("h:i", "$timein");
$eventDate4 = DateTime::createFromFormat("h:i", "$timeout");

but still can't do the restrictions so how to put restriction in my inputs for it to prevent accepting values in between two time values