I want to determine how time elapsed between dates, I have different tables where I have initial time for example [2016-05-28] and [13:36:42] and the other time [2016-05-31] and [09:05:18]
I want to know, how i can determine the time elapsed, in this case i will have "Two days with 20 hours"
The language that i am using are PHP, mysql, with any framework and angularjs, also where is the most recommendable side to make it
Simple PHP code:
<?php $dates = ['2016-05-12 05:33:02','2016-07-17 05:00:12']; $time_diff = strtotime($dates) - strtotime($dates); $time_diff<0?$time_diff*=-1:null; print floor($time_diff/86400) . ' days ' . floor(($time_diff % 86400) / 3600) . ' hours ' . floor(($time_diff % 3600) / 60) . ' minutes'; ?>
prints: 65 days 23 hours 27 minutes