datetime - How to get the total hour from starting time to end time in php -
how can total hour start time end time.
$start_time = '11:00:00 pm'; // of 07/08/2013 $end_time = '01:00:00 am'; // of 08/08/2013
then output should be:
$total = '02:00:00'; // 12 hour format
you can convert date strings time values, subtract difference in seconds between two, divide 3600 difference in hours:
$t1 = strtotime('2013-08-07 23:00:00'); $t2 = strtotime('2013-08-08 01:00:00'); $differenceinseconds = $t2 - $t1; $differenceinhours = $differenceinseconds / 3600;
Comments
Post a Comment