Month Display Issue

I am having a issue

When it is the end of the month like now it displays the next month as March

as there is not a 29th of Feb

How can I fix this issue?



$month_from_date = date("Y-m-d"); // any date.

for ($a=0; $a<=12; $a++)
{




$the_month_array[]= date("F Y", strtotime("$month_from_date + $a month"));
 
 
 
 
}


$thismonth = date('m');
$thisyear = $nextmonthYear = date('Y');
$nextmonth = $thismonth + 1;

if ($nextmonth == 13)
{
  $nextmonth = 1;
  $nextmonthYear++;
}

Don’t use the current day in $month_from_date, but the first day of the month. The first day of the month exists even in February :slight_smile:

haha

very clever

Thank you