I'm having a bit of an issue getting the hours worked to display the correct hours worked.
Here is the code that I am using:
<?php while($row = $approvedTimes->fetch()){ ?>
<tr>
<td><?php echo $row['userFirst'] . " ". $row['userLast']; ?></td>
<td><?php echo $row['companyName']; ?></td>
<td><?php echo date('Y-M-d',strtotime($row['timeDate'])); ?></td>
<td><?php echo date("h:i a",strtotime($row['timeStart'])); $start = $row['timeStart']; ?></td>
<td><?php echo date("h:i a",strtotime($row['timeEnd'])); $end = $row['timeEnd'] ; ?></td>
<td><?php echo $row['timeBreak'] . " min."; $break = $row['timeBreak']; ?></td>
<td><?php $hours = strtotime($end) - strtotime($start) -($break*60) ; echo number_format($hours/3600,2, '.', '') . " hours"; ?></td>
</tr>
<?php } ?>
If you notice the second record is outputting -17.50 hours but the hours worked should be 6.5 hours. I believe that the problem is that it is seeing both times in seconds but I'm unsure of how to be able to change it to display the correct hours worked based on the start and end time.
This is the table I output: