1$start_date = '2020-10-21';
2$end_date = '2020-10-15';
3$date_check = '2020-08-28';
4
5if ($this->check_in_range($start_date, $end_date, $date_from_user)) {
6 echo "within range";
7} else {
8 echo "not within range";
9}
10
11function check_in_range($start_date, $end_date, $date_from_user) {
12 // Convert to timestamp
13 $start = strtotime($start_date);
14 $end = strtotime($end_date);
15 $check = strtotime($date_from_user);
16
17 // Check that user date is between start & end
18 return (($start <= $check ) && ($check <= $end));
19}