You can use DateTime
$userDate = new DateTime("2012-03-01");
if ( $userDate > new DateTime("2012-03-21 00:00:00") && $userDate < new DateTime("2012-04-19 23:59:59"))
{
// In Range
}
Putting it in a function if format is (1 july)
if (inRange ( "1 June", "3 March", "7 December" )) {
echo "In Range";
} else {
echo "Out Of Range";
}
function inRange($dateCheck, $dateFrom, $dateTo) {
$date = DateTime::createFromFormat ( "d F", $dateCheck );
$date1 = DateTime::createFromFormat ( "d F", $dateFrom );
$date2 = DateTime::createFromFormat ( "d F", $dateTo );
if ($date > $date1 && $date < $date2) {
return true;
}
return false;
}