This was a difficult one to get right, comparing the Month and Year only was full of surprises.
My variable $joined was “2019-12-01 00:00:00”
and my Month was “Jul” and my Year was “2019”
Just cut and paste and your done!
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
$month="Jul"; $year="2019"; $mydate="2018-12-01 00:00:00"; $joined = date("Ym", strtotime($mydate)); $askedfor = $month." ".$year; $askedfor = date("Ym", strtotime($askedfor)); if ($askedfor > $joined) { echo "yes"; } else { echo "no"; } |