I have tried several of the examples mentioned on stackoverflow about this issue, but I can't figure out why the returns I get are inconsistent with expected behaviour. I'm trying to get every user that had their birthday last month. Birthdays are stored as follows: d-m-yyyy. The following sample code shows the issue:
$start = "01-10-2019";
$end = "31-10-2019";
$test = "01-11-1968";
$start_date = date("d-m", strtotime($start));
$end_date = date("d-m", strtotime($end));
$test_date = date("d-m", strtotime($test));
if(($test_date >= $start_date) && ($test_date <= $end_date))
{
error_log("date is in between");
} else
{
error_log("is not");
}
This code returns "date is in between", even though the expected return is "is not". It seems that everything date before $start
gives the proper return, but everything after $end
does not.