I am trying to work out I have 2 dates and I want to have them compared to todays date. If both dates are greater that today make status active else expired. If 1 date is greater (active) and the other is less than today it should change to expired. Here is my code. I cannot get this to work correctly. I cannot work out what I am missing
$currentDate = date('Y-m-d');
$currentDate = date('Y-m-d', strtotime($currentDate));
$date1 = date('Y-m-d', strtotime("22/10/2021"));
$date2 = date('Y-m-d', strtotime("23/08/2021"));
if (($date1 > $currentDate) && ($date2 > $currentDate)) {
echo "Active";
} else {
echo "Expired";
}