datetime php add days code example
Example 1: php date plus days
<?php
$date = "2019-05-10";
echo date('Y-m-d', strtotime($date. ' + 10 days'));
?>
Example 2: php date strtotime add days
$n = date('Y-m-d', strtotime( $d . " +1 days"));
$n = date('Y-m-d', strtotime( $d . " +1 month"));
$n = date('Y-m-d', strtotime( $d . " +1 year"));
$n = date('Y-m-d', strtotime( $d . " -1 days"));
$n = date('Y-m-d', strtotime( $d . " -1 month"));
$n = date('Y-m-d', strtotime( $d . " -1 year"));
Example 3: add 7 days to date php
$date = "Mar 03, 2011";
$date = strtotime($date);
$date = strtotime("+7 day", $date);
echo date('M d, Y', $date);
Example 4: add 1 day php datetime
$date = new DateTime('2000-01-01');
$date->add(new DateInterval('P1D'));