Good afternoon. To display statistics you need to get a list of the last 6 and 12 months from the current inclusive. I tried:
for($i = 11;$i > -1;$i--){ $m = $i*30; $index = date('Ym',strtotime('-'.$i.' days',strtotime("today"))); }
But since the months are not always 30 days, the list will be inaccurate in the last days of the month. Who can faced a similar problem and knows how to solve?