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

Example #1 Further DateTime::add examples

Result: 2000-01-01 10:00:30 2007-06-05 04:03:02
PHP Version:

Example #2 Beware when adding months

Result: 2001-01-31 2001-03-03
PHP Version:

Example #3 DateTime::add example

Result: 2000-01-11
PHP Version:


Function DateTime::add:

Date and Time Functions

Most used PHP functions