更新时间:2023-12-05 10:53:52
该日期间隔字符串为 ISO 8601持续时间规范,并且可以与 DateTime()
和 DateInterval()
That date interval string is an ISO 8601 duration specification and can be use with DateTime()
and DateInterval()
$date = new DateTime();
$date->add(new DateInterval('P0DT0H1M4S'));
echo $date->format('Y-m-d H:i:s');
或作为单线(PHP 5.4 +)
or as a one-liner (PHP 5.4+)
echo (new DateTime())->add(new DateInterval('P0DT0H1M4S'))->format('Y-m-d H:i:s');