how to check date time in range php code example
Example: check if date is within range php
$start_date = '2020-10-21';
$end_date = '2020-10-15';
$date_check = '2020-08-28';
if ($this->check_in_range($start_date, $end_date, $date_from_user)) {
echo "within range";
} else {
echo "not within range";
}
function check_in_range($start_date, $end_date, $date_from_user) {
$start = strtotime($start_date);
$end = strtotime($end_date);
$check = strtotime($date_from_user);
return (($start <= $check ) && ($check <= $end));
}