Hi All
I'm having a bit of an issue calculating the number of hours between two times.
Basically, I am calculating a team rota creation program in PHP to allow managers to create a team schedule online. There's then a read only page for the staff to log in and see their hours.
When creating the rota, the manager selects a slot and a window appears. You select the department they will work in and then enter a start time in the "field_start" input box and finish time in the "field_finish" input box in HH:MM format.
During the week shift patterns are generally 10:00 - 17:00, 17:00 - 00:00, 18:00 - 00:00 or 12:00 - 20:00.
Then friday/sat/sun, you get some 14:00 - 22:00, but the finish time is 01:00 (i.e. the next day). But if you're on a day shift, the start is generally 09:45 - 17:00.
So based on having for example a start time of "16:00" and end time of "01:00" how would i go about calculating the number of hours (which should be 9)? And then the same for an 09:45 - 17:00 start, this should say 7:15 (or 7.25 would be better as this is the format i need it in ultimately).
I've had a look around and all i can see are ones where you enter in the full date string...
Thanks for your time
Carl