DateTime::add

PHP 5 >= 5.3.0, PHP 7, PHP 8
DateTime::add - Adds an amount of days, months, years, hours, minutes and seconds to a DateTime object
Manual
Code Examples

DateTime::add( DateInterval$interval ): public DateTime

Procedural style

DateTimedate_add DateTimeobject DateIntervalinterval

Parameters

object

Procedural style only: A DateTime object returned by date_create. The function modifies this object.

interval

A DateInterval object

Return Values

Returns the DateTime object for method chaining or false on failure.

Related Functions

Example of DateTime::add

Show all examples for DateTime::add

PHP Version:


Function DateTime::add:

Date and Time Functions

Most used PHP functions