DateTime Confict Function PHP
$timeExist = checkTimeConfict(strtotime($postStartTime),strtotime($postEndTime),strtotime($dbStartTime),strtotime($dbEndTime));
if($timeExist){ // NOT IN CONFICT
$isTimeOverlap = 0;
}else{ // TIME OVERLAP
$isTimeOverlap = 1;
break;
}
function checkTimeConfict($post_start_time1,$post_end_time1,$db_start_time2,$db_end_time2)
{
$timeCheck;
if(($post_end_time1 < $db_start_time2))
{
$timeCheck = true;
return $timeCheck;
}
else if(($post_start_time1 > $db_start_time2) && ($post_start_time1 > $db_end_time2))
{
$timeCheck = true;
return $timeCheck;
}
else
{
$timeCheck = false;
return $timeCheck;
}
}
Rht