0

Why this doesn't work :

$start = new DateTime('2018-03-11 22:05:43');
$end = new DateTime('2018-03-11 23:15:23');
$interval = $end->diff($start);
echo $interval;

I want to get the difference between two dates and I think it better to use DateTime than strtotime.

Thanks.

  • please explain what are you trying to achieve – Seif Hatem Mar 14 '18 at 01:30
  • its just a DateTime object, to get some meaning out of it, you'll have to use the appropriate method, `->format('date format here')` or whatever, just read the php docs – Kevin Mar 14 '18 at 01:32

0 Answers0