Copyright © tutorialspoint.com
|
void date_modify ( DateTime $object, string $modify ) void DateTime::modify ( string $modify ) |
These functions alter the timestamp given in the passed object.
The above two functions are equivalent and any of the functions can be used as shown below in the example.
| Parameter | Description |
|---|---|
| object | Required. DateTime object |
| modify | Required. String in a relative format |
Returns NULL on success or FALSE on failure.
Following is the usage of this function:
<?php
$date = new DateTime("2006-12-12");
$date->modify("+1 day");
echo $date->format("Y-m-d");
?>
|
This will produce following result:
2006-12-13 |
Copyright © tutorialspoint.com