PHP date_modify() Function
Definition
The date_modify() function modifies the timestamp.
Syntax
PHP date_modify() Function has the following syntax.
date_modify(object,modify);
Parameter
Parameter | Is Required | Description |
---|---|---|
object | Required. | DateTime object returned by date_create() |
modify | Required. | Date/time string |
Return
PHP date_modify() Function returns a DateTime object on success. FALSE on failure.
Example
Add 15 days to the timestamp
<?php/* w w w. j a va 2 s . co m*/
$date=date_create("2013-05-01");
date_modify($date,"+15 days");
echo date_format($date,"Y-m-d");
?>
The code above generates the following result.