jkkenzie Posted September 6, 2011 Share Posted September 6, 2011 $startdt = $_POST['startdt'].":".$_POST['starttmh'].":".$_POST['starttmm'].":".$_POST['sAMPM']; // 09/08/2011:11:35:AM $enddt = $_POST['enddt'].":".$_POST['endtmh'].":".$_POST['endtmm'].":".$_POST['eAMPM']; //09/09/2011:11:35:AM From the code above I want to subtract 09/08/2011:11:35:AM from 09/09/2011:11:35:AM and get the total number of hours. A simple solution would be highly appreciated: thanks in advance: Link to comment https://forums.phpfreaks.com/topic/246574-subtract-datetime-to-get-total-hours-and-days/ Share on other sites More sharing options...
WebStyles Posted September 6, 2011 Share Posted September 6, 2011 You can convert both to seconds with strtotime then substract one from the other... Link to comment https://forums.phpfreaks.com/topic/246574-subtract-datetime-to-get-total-hours-and-days/#findComment-1266186 Share on other sites More sharing options...
jkkenzie Posted September 7, 2011 Author Share Posted September 7, 2011 ok Thanks . Link to comment https://forums.phpfreaks.com/topic/246574-subtract-datetime-to-get-total-hours-and-days/#findComment-1266326 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.