How can we calculate a time point plus a long time? for example, if a video is released at 22:50:00 and the total length of time is 01:40:00, how can we calculate the final end time?
Reply to discussion (solution)
$date = new DateTime('22:50:00');$date->add(new DateInterval('PT01H40M00S'));echo $date->format('H:i:s');
00:30:00
Is this the only way for the moderator? do you need to convert it at 01:40:00?
This works too.
echo date('H:i:s', strtotime('22:50:00') + strtotime('01:40:00') - strtotime('00:00:00'));
00:30:00
Eat the chews that others chew
Learn to use tools in your hands
Call to undefined method DateTime: add () does not have this method?
This works too.
echo date('H:i:s', strtotime('22:50:00') + strtotime('01:40:00') - strtotime('00:00:00'));
00:30:00
Eat the chews that others chew
Learn to use tools in your hands
What tools
DateTime: add
(PHP 5> = 5.3.0)
DateTime: add
(PHP 5> = 5.3.0)
It turns out that ..
This works too.
echo date('H:i:s', strtotime('22:50:00') + strtotime('01:40:00') - strtotime('00:00:00'));
00:30:00
Eat the chews that others chew
Learn to use tools in your hands
What tools
Manual !!!