Working with Date Intervals in PHP


Add or subtract dates using DateInterval with a DateTime object.

Source Code

$date = new DateTime('now');
$date->add(new DateInterval('P10D')); // Adds 10 days
echo $date->format('Y-m-d');
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments