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"); ?>
Definition and Usage
The date_modify() function modifies the timestamp.
Syntax
date_modify(object,modify);
Parameters | Description |
---|---|
object | Required. Specifies by date_create() The returned DateTime object. |
modify | Required. Specifies a date/time string. |
Technical Details
Return Value: | If successful, returns a DateTime object. If failed, returns FALSE. |
---|---|
PHP Version: | 5.2+ |
Update Log: | PHP 5.3.0: The return value has changed from NULL to DateTime. |