📜  添加或减去时间 - PHP 代码示例

📅  最后修改于: 2022-03-11 14:54:13.147000             🧑  作者: Mango

代码示例1
$dateTime = new DateTime('2016-01-01');
$dateTime->modify('+1 day');
echo $dateTime->format('Y-m-d H:i:s');`
# Output: 2016-01-02 00:00:00

# You can as well use the constructor if you work on the current date:



$dateTime = new DateTime('+1d');
echo $dateTime->format('Y-m-d H:i:s');`
# Output the current date plus one day.