Calculate Difference in Time with PHP
Howdy folks! :)
I've been working on a new project that calculates hours worked. I need to take up to three 24hr clock IN and clock OUT entries stored in MySQL and come up with a calculated sum difference in time.
I've seen lots of examples from folks via Google searches, but I'm stuck. I can't seem to get the the calculations right.
I am storing up to a possible 3 entries per/work day. Below is my weak attempt to get started...
$query = "SELECT * FROM emphours
WHERE `Date` BETWEEN '".$_POST['Start']."' and '".$_POST['End']."'";
$ext1 = "$time1:";
$ext2 = "$time2:";
$ext3 = "$time3:";
$ExtTot = $ext1 + $ext2 + $ext2;
I found a web tool that is an outstanding example of what I'm trying to accomplish, except I need to make some modifications to suit my exact requirements... I'm attempting to contact the author/website owner to gain some insight.
The scripting this site has is right on target.
Any tips, pointers, suggestions would be greatly appreciated.