Calculating shift hours worked
<p>I'm am trying to calculate the hours for someone based on the number of hours worked and the time period in which they worked.</p>

<p>For example: </p>

<p>The shift patterns are 07:00 to 15:00 is 'morning', 15:00 to 23:00 is 'afternoons', and 23:00 to 07:00 is 'nights'.</p>

<p>Therefore if I started at 08:00 and finished at 17:30, this would mean that I get paid 7 'morning' hours and 2.5 'afternoon' hours.</p>
