Dinesh Chhabra has written 1 article

Example to display next month’s date from current date without skipping any day or month in PHP

Want to display next month’s date from current date without skipping any day or month, here is the example: <?php $date = '31-01-2016'; echo nextDate($date); function nextDate($currentDate){ $getCurrentMonth = date("m",strtotime($currentDate)); $getCurrentDate = date("d",strtotime($currentDate)); $getCurrentYear = date("Y",strtotime($currentDate)); $currentMonthplus = $getCurrentMonth+1; $getNextMonth = date("m",strtotime('+1 month',strtotime($currentDate))); if($currentMonthplus != $getNextMonth){ $nextDates = date('t M Y', strtotime('01-'.$currentMonthplus.'-'.$getCurrentYear.'')); }else{ $nextDates =…