How can I get the difference of a time.
Let's say the first time value is this:
00:01:00
and the second one is this:
00:03:00
How can I get the difference with the same format.
How can I get the difference of a time.
Let's say the first time value is this:
00:01:00
and the second one is this:
00:03:00
How can I get the difference with the same format.
Try this one
$startTime = new DateTime("00:01:00");
$endTime = new DateTime("00:03:00");
$interval = $startTime->diff($endTime);
echo $interval->format('%H:%I:%S');
Outputs:
00:02:00
As you asked you wants it to be in same format.