PHP date; How to find the next year?
From PHP's documentation:
<?php
$date = new DateTime($your_supposed_date);
$date->add(new DateInterval('P1Y'));
echo $date->format('Y-m-d') . "\n";
?>
Gordon's much cleaner version (Thank you!):
<?php
$date = new DateTime("+12 months $theDate");
echo $date->format('Y-m-d') . "\n";
?>
echo date('Y', strtotime('+1 year'));
$Ad_year = 2015-10-20
<?php echo $Ad_year + 1?>
Result 2016
You can use strtotime
and date
$date = '2010-09-16';
echo date('Y-m-d', strtotime("+12 months $date"));
// 2011-09-16
On a sidenote: DateTime questions like this have been answered over and over again, so you could have found how to add to a date easily by using the search function.