date php - 1 day code example
Example 1: php date + one day
<?php
$stop_date = '2009-09-30 20:24:00';
echo 'date before day adding: ' . $stop_date;
$stop_date = date('Y-m-d H:i:s', strtotime($stop_date . ' +1 day'));
echo 'date after adding 1 day: ' . $stop_date;
?>
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: in date function + 1 month and - 1 day in php
<?php
$months = n;
$years = n;
echo date('Y-m-28', mktime(0, 0, 0, date('m')+$months, 1, date('Y') + $years));
?>