Installer wrote:Or calculate from the 15th of the current month, adding one month:
echo "next month: " . date('F', strtotime('+1 month', date('m15Y')));
I had to implement this method in one area. Working from the 15th of a month is sort of a safe way to do it, but hardly seems the right way. It seems as though +1 month in PHP is being used as +31 day which obviously is not right. I had to use the following:
date("M", mktime(0,0,0,date("n")+1,1,date("Y")));
Someone else recommended I use this:
date("F", strtotime("+1 month", strtotime("January 31 2006")));
which is probably better than what I had, at least more simple, but it still returns the wrong month.
Does this seem like a PHP bug to you guys? Any potential issues you see with using the mktime() function instead?