比如某个影片的上映时间是22:50:00,电影时间总长度是01:40:00 ,这样怎么计算出最后 的结束时间呢
回复讨论(解决方案) $date = new datetime('22:50:00');$date->add(new dateinterval('pt01h40m00s'));echo $date->format('h:i:s');
00:30:00
只有版主这种方法吗 01:40:00这个需要转换下?
这样也行 echo date('h:i:s', strtotime('22:50:00') + strtotime('01:40:00') - strtotime('00:00:00'));
00:30:00
吃别人嚼过的馍不香
要学会使用手中的工具
call to undefined method datetime::add() 没这个方法呢
这样也行 echo date('h:i:s', strtotime('22:50:00') + strtotime('01:40:00') - strtotime('00:00:00'));
00:30:00
吃别人嚼过的馍不香
要学会使用手中的工具
什么工具
datetime::add
(php 5 >= 5.3.0)
datetime::add
(php 5 >= 5.3.0)
原来如此。。
这样也行 echo date('h:i:s', strtotime('22:50:00') + strtotime('01:40:00') - strtotime('00:00:00'));
00:30:00
吃别人嚼过的馍不香
要学会使用手中的工具
什么工具
手册!!!