I have 2 dates. One is $monthToCheck = date('Y-m-01');
and the other one comes from an API and its stored in a variable : $reqs['end_date']
. My question is : How do i check if the date from the api is bigger than $monthToCheck. With bigger i mean for example 2020 - 01 - 01 is bigger than 2019 - 12 - 01 because the year is higher.
What i tried :
$time = strtotime($reqs['end_date']);
$monthToCheck = date('Y-m-01');
if($time > $monthToCheck) {...}
I converted the date from the API to a date using strtotime and then compared it with my $monthToCheck variable.But i have a feeling something isnt right since the results are all "true" eventho that is not always the case.