PHP date_modify() Function

Example

Modify the timestamp. Increase by 15 days:

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

Running Example

Definition and Usage

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 the date/time string.

Technical Details

Return Value: Returns a DateTime object if successful. Returns FALSE if failed.
PHP Version: 5.2+
Update Log: PHP 5.3.0: Return value changed from NULL to DateTime.