Funkcja konfliktu datetime PHP
<?php
$timeExist = checkTimeRange(strtotime($postStartTime),strtotime($postEndTime),strtotime($dbStartTime),strtotime($dbEndTime));
if($timeExist){ // NOT IN RANGE
$isTimeOverlap = 0;
}else{ // TIME OVERLAP
$isTimeOverlap = 1;
break;
}
function checkTimeRange($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