0

Get difference of two times

I use below code to get difference of start time and end time. $totalTime = strtotime($endTime)-strtotime($startTime); But some time it return 00:00:00 Why this happens? Please help.

9th Apr 2017, 11:33 AM
Salman Mushtaq
Salman Mushtaq - avatar
1 Resposta
0
in PHP 5 and up you can use: <?php $date = new DateTime('2000-01-20'); $date->sub(new DateInterval('P10D')); echo $date->format('Y-m-d') . "\n"; ?>
10th Apr 2017, 11:31 PM
Jean-louis du Plessis
Jean-louis du Plessis - avatar