且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

PHP将两个时间变量相加

更新时间:2023-11-29 18:54:40

做到这一点的***方法是最有可能使用strtotime将它们转换为时间戳,然后进行加法运算:

The best way to do this is most likely to use strtotime to convert them to timestamps and then do the adding together:

$o = strtotime($time1)+strtotime($time2);

如果我没记错的话,strtotime确实支持这种格式.

If I remember right strtotime does support this format.

否则,您需要自己将其过滤掉.

Otherwise you will need to filter it out yourself.