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);
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 if successful. Returns FALSE if failed. |
---|---|
PHP Version: | 5.2+ |
Update Log: | PHP 5.3.0: Return value changed from NULL to DateTime. |