Time tracking attendance using php

Hi All,

In my website (PHP & MYSQL), I have on functionality which tracks the in-out data from swipe card system and displays first in and last out in report.

This I have done. But, now I am having an issue for the employee working in night shifts. The swip card system is in MSSQL Server.
And the data is stored in one of the table with fields cardno, iodatetime. The field iodatetime stores the data for in and out both. Consider the following scenario
Night Shift Employee ‘A’ comes in the office at 17:00PM (Consider: Date 9th Aug, 2012) and leaves on 9:00AM (Date: 10th Aug, 2012).and I want to show in-out data date wise like
Date 9Aug 10thAug
In Time 18:00 9:00AM
Out Time 23:58(if left for a break)
Total Hours 5:58

Please let me know the approach for calculating the total hours datewise for employee working in shifts.

Your help will be highly appreciated.

Thanks in advance.

Using a DateTime object should get you started. Once you have some code started, post it and I’ll be glad to help you work out the bugs

I could swear we’ve answered this before from another user… anyway.

Your demonstration doesnt show what you think it shows.
You said:
Night Shift Employee ‘A’ comes in the office at 17:00PM (Consider: Date 9th Aug, 2012) and leaves on 9:00AM (Date: 10th Aug, 2012)

That would be a shift of 16 hours (17-24+0-9).

You then show the data as:

Date 9Aug 10thAug
In Time 18:00 9:00AM
Out Time 23:58(if left for a break)
Total Hours 5:58

Where did Out Time come from? Why does your total hours think he was only there for a hair under 6 hours? (18:00-23:58) Did he leave then and not come back? Where did the 9:00 come from (or go?)