PHP date_modify () function
PHP Date / Time Reference Manual
Examples
Modification timestamps. Increase in 15 days:
<?php
$date=date_create("2013-05-01");
date_modify($date,"+15 days");
echo date_format($date,"Y-m-d");
?>
$date=date_create("2013-05-01");
date_modify($date,"+15 days");
echo date_format($date,"Y-m-d");
?>
Running instance »
Definition and Usage
date_modify () function to modify the timestamp.
grammar
date_modify( object,modify);
参数 | 描述 |
---|---|
object | 必需。规定一个由 date_create() 返回的 DateTime 对象。 |
modify | 必需。规定一个日期/时间字符串。 |
technical details
return value: | If successful, it returns a DateTime object. If it fails it returns FALSE. |
---|---|
PHP version: | 5.2+ |
Update log: | PHP 5.3.0: the return value from NULL to DateTime. |
PHP Date / Time Reference Manual