PHP date_modify() Function

Example

Modify the timestamp. Add 15 days:

<?php
$date=date_create("2016-09-25");
date_modify($date,"+4 days");
echo date_format($date,"Y-m-d");
?>

Running Instance

Definition and Usage

The date_modify() function modifies the timestamp.

Syntax

date_modify(object,modify);
Parameter Description
object Required. Specifies by date_create() The returned DateTime object.
modify Required. Specifies a date/time string.

Technical Details

Return Value: Returns a DateTime object on success. Returns FALSE on failure.
PHP Version: 5.2+
Update Log: PHP 5.3.0: The return value has changed from NULL to DateTime.