I'm trying to work out date differences between two dates,
1) "today" ie. date('Y-m-d') and
2) $mydate => a date also in Y-m-d format.
I tried something like this:
$expiry_date = "2106-07-11";
$today = date('Y-m-d');
$now_yearArr = getdate();
$nowyear = $now_yearArr[year];
$nowmonth = $now_yearArr[mon];
$exp_yearArr = getdate($expiry_date);
$expyear = $exp_yearArr[year];
$expmonth = $exp_yearArr[mon];
but this outputs:
2007 <== correct
8 <==== correct
1970 <===WRONG/not what I expect===== is 2106 out of range for this function?
1 <===WRONG/not what I expect
The reason I have a date in the future is for "lifetime" members. Is the date simply out of range, or is there another way to do this.
Further down in my code, I'm checking to see if the expirey date is less than 60 days from "today" do that I can mark the date in orange; if it' 0 or less, I mark it as red.
Any help appreciated.