比如:
$date1 = "2016-11-25 09:53:58";
$p_time = "00:02:34";
// $date1 + $p_time
结果输出:
"2016-11-25 09:56:32"
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
使用PHP内置的DateTime对象
使用方法可以参考官方文档 http://php.net/manual/en/date...
其中增加的时间格式是遵循ISO 8601规范的。
date('Y-m-d H:i:s',strtotime('+2minute 34seconds'));
若要将两个时间想加,将两个时间都转换成时间戳,然后再转换成时间。