If you want to have the next month, I suggest you to use the current year and month but keep using the 1st.
Current Date
$today = $today = date("Y-m-d");
Next Month Date
$date = date("Y-m-01");
$newdate = strtotime ( '+1 month' , strtotime ( $date ) ) ;
This way, you will be able to get the month and year of the next month without having a month skipped.
One month from today
$date = date('Y-m-d', strtotime('+1 month'));
One month from a specific date
$date = date('Y-m-d', strtotime('+1 month', strtotime('2015-01-01')));
No comments:
Post a Comment