Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

PHP date_add() Function

PHP date_add() Function

PHP Date/Time PHP Date/Time Reference Manual

Example

Add 40 days to March 15, 2013:

Run Example »


Definition and Usage

The date_add() function adds days, months, years, hours, minutes, and seconds to a date.

Syntax

date_add(

object,interval);

Parameters Description
object Required. Specifies a date_create() DateTime object returned by
interval Required. Specifies a DateInterval object.

Technical Details

Return Value: Returns a DateTime object on success, or FALSE on failure.
PHP Version: 5.3+

PHP Date/Time PHP Date/Time Reference Manual