and it saves in db Emp no Time In Time Out100603 2011-10-01 07:30:00 2011-10-01 18:00:00100603 2011-10-02 08:00:00 2011-10-01 18:30:00

I want the timein and time out is formatted in 12 hours. As you can see the time out is formatted in 24 hours.

Thank you...

Actually, both time in (07:30:00) and time out (18:00:00) are formatted in 24 hour format, and that is the way the database stores the information. Maybe if you explain what you are trying to accomplish, one of the members here can point you in the correct direction.

Actually, both time in (07:30:00) and time out (18:00:00) are formatted in 24 hour format, and that is the way the database stores the information. Maybe if you explain what you are trying to accomplish, one of the members here can point you in the correct direction.

I upload .xml using php and it saves to database.

I upload .xml using php and it saves to database.

I tried this data to upload:100603 10/1/11 5:35 AM 10/1/11 1:35 PM // this is the exact schedule of employee and its 8 hours per day he time in exactly and timeout exactly also, so no problem in computing because it is 8 hours.100603 10/2/11 5:25 AM 10/2/11 1:55 PM //in this example data the employee time in early in his schedule and time out late. 100603 10/3/11 5:40 AM 10/3/11 1:40 PM // in this example data the employee time in is late, so even he also late to timeout theres no exemption because he late on his work.

the first is correct because the real schedule is 5:35 AM - 1:35 PMthe second is wrong it should be 8 hours only even he timein early and timeout late.the third is also wrong because the employee is late to timein, even he also timeout late., it should be deduct or subtract in hours the late of employee.

I tried this data to upload:100603 10/1/11 5:35 AM 10/1/11 1:35 PM // this is the exact schedule of employee and its 8 hours per day he time in exactly and timeout exactly also, so no problem in computing because it is 8 hours.100603 10/2/11 5:25 AM 10/2/11 1:55 PM //in this example data the employee time in early in his schedule and time out late. It should be only 8 hours.100603 10/3/11 5:40 AM 10/3/11 1:40 PM // in this example data the employee time in is late, so even he also late to timeout there’s no exemption because he late on his work. So it should has deduction or minus in his total hours.

I want to accomplish is to get the total hours of the employee based on the employee no. And even the employee get timein early before his time or late to timeout the hours computed only 8 hours. Honestly, I don’t have idea how can be possible it is.

the first is correct because the real schedule is 5:35 AM - 1:35 PMthe second is wrong it should be 8 hours only even he timein early and timeout late.the third is also wrong because the employee is late to timein, even he also timeout late., it should be deduct or subtract in hours the late of employee.

in pseudocode that would result in being processed with something like:

if( $late === false && $total_hrs > 8 )
// pay the man
if($late === true )
// work out penalty of lateness
// see if they went home early - find that penalty
// add them together, and apply

Does that give you a leg up?

You could get mysql to return you a flag for "late" with some effort, but that would entail putting that logic into your database queries, when I suspect that start_time is could be quite a variable thing, as could the length of a working day, the insertion of lunch breaks etc.

These things are best left to PHP to perform, at least when starting out.

EDIT

Cripes, took me that long to create a reply! ... well, at least you have 2 different views now ...

The real schedule of employee DS-1001 is from 9:35 PM to 5:35 AM he is night shift and the employee DS-1002 is from 5:35 AM to 1:35 PM he is morning shift.

here is the sample .xml fileEMP_NO Time In Time OutDS-1001 10/1/11 9:35 PM 10/2/11 5:35 AM // this is the exact timein and timeout so theres no problemDS-1001 10/2/11 9:00 PM 10/3/11 6:00 AM // in this sample the employee timein early and also timeout late. DS-1001 10/3/11 10:00 PM 10/4/11 5:00 AM // in this sample the employee late to timein and he timeout early, so it should be subtract in his attendance total hours,DS-1002 10/1/11 5:35 AM 10/1/11 1:35 PM// this is the exact timein and timeout so theres no problemDS-1002 10/2/11 5:00 AM 10/2/11 2:00 PM// in this sample the employee timein early and also timeout late. DS-1002 10/3/11 6:00 AM 10/3/11 1:00 PM// in this sample the employee late to timein and he timeout early, so it should be subtract in his attendance total hours,

EMP_NO datatype is varchartimein datatype is datetimetimeout datatype is datetimetotal datatype is timerendered datatype is timeOT datatype is time

the total field is the sum of the total hours of the employeethe rendered field is the exact 8 hours of employee or if the employee late like for example he is late or timeout early it should be subtracted and be output in rendered but normally it is 8 hours if his not late. In this field I don't have idea how can i do that.the OT field is the total - rendered field.

I dont know how can I insert that in my database.

I used this code to get the total hours but it did not work, and no error displayed.

The real schedule of employee DS-1001 is from 9:35 PM to 5:35 AM he is night shift and the employee DS-1002 is from 5:35 AM to 1:35 PM he is morning shift.

here is the sample .xml fileEMP_NO Time In Time OutDS-1001 10/1/11 9:35 PM 10/2/11 5:35 AM // this is the exact timein and timeout so theres no problemDS-1001 10/2/11 9:00 PM 10/3/11 6:00 AM // in this sample the employee timein early and also timeout late. DS-1001 10/3/11 10:00 PM 10/4/11 5:00 AM // in this sample the employee late to timein and he timeout early, so it should be subtract in his attendance total hours,DS-1002 10/1/11 5:35 AM 10/1/11 1:35 PM// this is the exact timein and timeout so theres no problemDS-1002 10/2/11 5:00 AM 10/2/11 2:00 PM// in this sample the employee timein early and also timeout late. DS-1002 10/3/11 6:00 AM 10/3/11 1:00 PM// in this sample the employee late to timein and he timeout early, so it should be subtract in his attendance total hours,

EMP_NO datatype is varchartimein datatype is datetimetimeout datatype is datetimetotal datatype is timerendered datatype is timeOT datatype is time

the total field is the sum of the total hours of the employeethe rendered field is the exact 8 hours of employee or if the employee late like for example he is late or timeout early it should be subtracted and be output in rendered but normally it is 8 hours if his not late. In this field I don't have idea how can i do that.the OT field is the total - rendered field.

I dont know how can I insert that in my database.

I used this code to get the total hours but it did not work, and no error displayed.

When I used this syntax, the output was add in total field and it is correct...Now my problem is in the rendered, i dont know how can I display the rendered time the 8 hours or below 8 hours if he is late or early to timeout.Because now in total i only used update query and i run it in mysql.

In rendered it only gets the 8 hours from like for example 9:35 PM to 5:35 AM if he timein 9:00 PM he only get from 9:35PM - 5:35 AM or if he timeout 5:40 AM only the 9:35 PM - 5:35 AM he sum and insert in rendered field.