Calculate Time Difference
I am using this code to calculate hours:
We want to use "24:00" midnight (military time)at the end of a shift. Unfortunately this results in an error.
Whats the best way to handle this?
***
Whatever I decide to do it's going to effect this MySQL query
Thanks for your help...
[More thoughts]
I guess we could use 00:00 and then absolute value to get rid of the negative... As long as I can do that with the Query too.
Shoot - 00:00 is interpreted as 0... 00:00 - 06:00 = -6. For the PHP I can juggle it to work. "if "24:00" yada yada
[After doing some test with MySQL]
I guess I dont have to worry about MySQL, its computing:
as 18 hours.
I guess I can accomodate for the PHP because that part is for display on one page.
After we can wipe out a series of bugs we are going to go back and add an end date. We just need to get this functional for the time being.
$hoursITEM = (strtotime($end_time) - strtotime($start_time))/3600;We want to use "24:00" midnight (military time)at the end of a shift. Unfortunately this results in an error.
Whats the best way to handle this?
***
Whatever I decide to do it's going to effect this MySQL query
$Query = "SELECT invoice_number, sum(((TIME_TO_SEC(end_time) - TIME_TO_SEC(start_time))/3600) * rate) AS subtotal FROM invoice_items WHERE office_id='$office_id' AND service_type!='225' GROUP BY invoice_number ORDER BY invoice_number";
Thanks for your help...
[More thoughts]
Shoot - 00:00 is interpreted as 0... 00:00 - 06:00 = -6. For the PHP I can juggle it to work. "if "24:00" yada yada
[After doing some test with MySQL]
I guess I dont have to worry about MySQL, its computing:
sum( ( TIME_TO_SEC(24:00) - TIME_TO_SEC(06:00) )/3600 )as 18 hours.
I guess I can accomodate for the PHP because that part is for display on one page.
After we can wipe out a series of bugs we are going to go back and add an end date. We just need to get this functional for the time being.
