php date next month code example
Example 1: php grab month from date
$month = date("m",strtotime($mydate));
Example 2: in date function + 1 month and - 1 day in php
echo Date("Y-m-d", strtotime("2013-01-01 +1 Month -1 Day"));
echo Date("Y-m-d", strtotime("2013-01-31 +1 Month -3 Day"));
echo Date("Y-m-d", strtotime("2013-01-31 +2 Month"));
echo Date("Y-m-d", strtotime("2013-01-31 +3 Month -1 Day"));
echo Date("Y-m-d", strtotime("2013-12-31 -1 Month -1 Day"));
echo Date("Y-m-d", strtotime("2013-12-31 -2 Month"));
echo Date("Y-m-d", strtotime("2013-12-31 -3 Month"));
echo Date("Y-m-d", strtotime("2013-12-31 -3 Month -1 Day"));
Example 3: get next month first day php
$config_month = 1;
$config_day = 1;
$new_expiry_date = date('Y-m-d', mktime(0, 0, 0, date('m') + $config_month, 1 + $config_day, date('Y')));
Example 4: getting last day of next month in php
$lastDateOfNextMonth =strtotime('last day of next month') ;
$lastDay = date('d/m/Y', $lastDateOfNextMonth);
print_r($lastDay);