Answer the question
In order to leave comments, you need to log in
How to add time to time?
Hello, I'll be brief, there are 2 variables:
1) $time1 = "00:08:27";
2) $time2 = "00:01:32";
how to get as a result: 00:09:59 ?
tried it with strtotime
$d1 = strtotime("00:08:27");
$d2 = strtotime("00:01:32");
echo gmdate("H:i:s", $d1 + $d2);
Answer the question
In order to leave comments, you need to log in
If something doesn't work for you, try reading the instructions.
gmdate — Formats a GMT date/time
Description
string gmdate ( string $format [, int $timestamp = time() ] )
This function is identical to the date() function, except that it returns Greenwich Mean Time (GMT).
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question