Hello,
I need to calculate hours worked between two times. For example:
$startTime = "08:00"; $endTime = "16:30";
Time worked is 8hrs 3mins
What is the best way to do this?
Thanks
Simplest way I can think of would be to [man]explode/man the two strings at the colon to give you the hours and minutes separately (possibly using [man]intval/man to make sure PHP knows they're integers) and then doing the simple arithmetic on those separate pieces.
You'll have to do some checking, however, if the time range spans multiple days.