I am capturing the 1st and last day of the current month in php. I then want to take it a step further and subtract 12 months so I can get the first and last day of the month 12 months ago, and 11 months ago. My issue is that the syntax NEVER changes from the current month. All of the results below produce 08/01/2017 and 08/31/2017
How should this be changed so that it produces accurate results?
$firstdayofmonth = date('Y-m-01');
$lastdayofmonth = date('Y-m-t');
$firstdayofmonth = date('m-d-Y', strtotime($firstdayofmonth));
$lastdayofmonth = date('m-d-Y', strtotime($lastdayofmonth));
$month12start = date($firstdayofmonth, strtotime("-12 months"));
$month12end = date($lastdayofmonth, strtotime("-12 months"));
$month11start = date($firstdayofmonth, strtotime("-11 months"));
$month11end = date($lastdayofmonth, strtotime("-11 months"));
echo $month12start;
echo $month12end;
echo $month11start;
echo $month11end;