php - Compute time difference for night shift time record -


i computing time difference of night shift schedule using time only

lets have data:

 $actual_in_time      = 6:45 pm        //date july 30, 2013  $actual_out_timeout  = 7:00        //date july 31, 2013 

i have compute time difference time in should converted whole time, therefore

 $actual_in_time     = //(some code convert 6:45 pm 7:00 pm)  $converted_in_time  = $actual_in_time; 

now here code that:

 $actual_out_time   += 86400;  $getinterval   = $actual_out_time - $converted_in_time;  $hours     = round($getinterval/60/60, 2, php_round_half_down);  $hours     = floor($hours); 

i not getting results wanted. how compute time difference basis time?

you can use second parameter in strtotime relative time.

$start = strtotime($starttime); $end = strtotime($endtime, $start);  echo ($end-$start)/3600; 

Comments

Popular posts from this blog

basic authentication with http post params android -

vb.net - Virtual Keyboard commands -

css - Firefox for ubuntu renders wrong colors -