DateTime::add
PHP function
Edit on GitHub ✎
(PHP 5 >= 5.3.0, PHP 7, PHP 8)
Modifies a DateTime object, with added amount of days, months, years, hours, minutes and seconds
Description
Oop
DateTime::add(DateInterval $interval): DateTime
Procedural
date_add(DateTime $object, DateInterval $interval): DateTime
Adds the specified DateInterval object to the specified DateTime object.
Like DateTimeImmutable::add but works with DateTime.
The procedural version takes the DateTime object as its first argument.
Parameters
intervalA
DateIntervalobject
Return Values
Modifiedobject