Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Increment PHP Months
$nextMonthDate = $date->copy();
// j - Day of the month without leading zeros
if ($nextMonthDate->format('j') != $date->format('j'))
$date->modify('last day of +'.$addMonths.' months');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment