Datediff for Time Clock
Hello. I am having a problem putting my mind around how this works. I am working on creating a time clock. When a person clocks in each day an entry is inserted into the database. As they continue to clock in or out that day entry in the database is updated to log the time/date stamp up to 6 entries.
| EmployeeID | TimeClockID | TimeEntryReg1 | TimeEntryVac | TimeEntrySick | TimeEntryHol | TimeEntryOther | TimeEntryOtherReason | SPROverride | SPROverrideDate | TimeEntryReg2 | TimeEntryReg3 | TimeEntryReg4 | TimeEntryReg5 | TimeEntryReg6 | |
| 10 | 1 | 11/12/2009 5:51:31 PM | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL |
When I call the query I can get the cfoutput to loop through each record and display each of the log in/out's. What my problem is is that I am not able to do a datediff to figure out how many hours/mins that employee has worked between the clock in and out. I get an error every time that says my date is invalid. I am guessing that it is because the variable is unable to determine which record is which since there are multiple records. Could someone PLEASE help me get my head around how to display the time worked correctly? Thanks.
<table width="800">
<cfoutput query="selectPerEmployeeTimeClockEntry">
<tr>
<td width="50" nowrap>
#DateFormat(TimeEntryReg1, "dddd mm/dd")#
</td>
<!--- <td width="50" nowrap>
#TimeFormat(TimeEntryReg1, "hh:mm:sstt")#
</td>
<td width="50" nowrap>
#TimeFormat(TimeEntryReg2, "hh:mm:ss tt")#
</td>
<td width="50" nowrap>
#TimeFormat(TimeEntryReg3, "hh:mm:ss tt")#
</td>
<td width="50" nowrap>
#TimeFormat(TimeEntryReg4, "hh:mm:ss tt")#
</td>
<td width="50" nowrap>
#TimeFormat(TimeEntryReg5, "hh:mm:ss tt")#
</td>
<td width="50" nowrap>
#TimeFormat(TimeEntryReg6, "hh:mm:ss tt")#
</td>
