Question: how to calculate time difference between two times in php?
Answer: $time1 = new DateTime('2017-01-23 18:16:25'); $time2 = new DateTime('2019-01-23 11:36:28'); $timediff = $time1->diff($time2); echo $timediff->format('%y year %m month %d days %h hour %i minute %s second'). "<br/>";