laravel validate if not between two dates code example
Example 1: check if date between two dates laravel eloquent
return Set::where('type', $type)
->whereDate('active_start', '<=', date("Y-m-d"))
->whereDate('active_end', '>=', date("Y-m-d"))
->first();
Example 2: check if date between two dates laravel
<?php
$currentDate = date('Y-m-d');
$currentDate = date('Y-m-d', strtotime($currentDate));
$startDate = date('Y-m-d', strtotime("01/09/2019"));
$endDate = date('Y-m-d', strtotime("01/10/2019"));
if (($currentDate >= $startDate) && ($currentDate <= $endDate)){
echo "Current date is between two dates";
}else{
echo "Current date is not between two dates";
}