total working hours

T

Tia

hi,
i am trying to create a data base for the time attendance of the
employees
i have date- time in- time out-time in 1-time out 1 "the time in and
out are date and time short time
i need to calculate total working hours per day
Total working hours = ?????

Thank you in advance
 
D

Douglas J. Steele

Assuming that by "total working hours per day", you simply mean the
difference in time between date/time in and date/time out, use the DateDiff
function.

Note, though, that the DateDiff function is a little odd in how it works. It
really calculates how many changes there have been encountered. For example,
it will report the difference between 05:59:59 and 06:00:00 as 1 hour,
because the hour changed from 5 to 6. You're best off calculating the
difference in minutes and dividing by 60.
 
T

Tia

Assuming that by "total working hours per day", you simply mean the
difference in time between date/time in and date/time out, use the DateDiff
function.

Note, though, that the DateDiff function is a little odd in how it works.It
really calculates how many changes there have been encountered. For example,
it will report the difference between 05:59:59 and 06:00:00 as 1 hour,
because the hour changed from 5 to 6. You're best off calculating the
difference in minutes and dividing by 60.

--
Doug Steele, Microsoft Access MVPhttp://I.Am/DougSteele
(no e-mails, please!)







- Show quoted text -

Thank you for your response, i have tried it and it was working for
the daily hours, but assuming that the employee came at 19:00 and
stayed after 12 example 25:30
than the calculation is not correct it is only calculating the daily
hours all of them are set for short time, is there is anything i
should change



thank you in advance
 
A

Al Campagna

Tia,
I think you are trying to say that you have break during the day,
within the day start D/T and the day end D/T.
I'll just work with the times here... but you can use your DateTime
values.
Example
DayStart BreakStart BreakStop WorkStop
9:00 am 12:00 pm 1:30 pm 4:00 pm

Determine the minutes between DayStart and DayEnd, and subtract the
difference between BreakStart and BreakEnd, and divide by 60 to get
hours.

=(DateDiff("n",DayStart,DayEnd) - DateDiff("n",BreakStart,BreakEnd)) /60

The above values would yield (420 mins - 90mins) / 60 = 5.5 hrs
--
hth
Al Campagna
Microsoft Access MVP
http://home.comcast.net/~cccsolutions/index.html

"Find a job that you love... and you'll never work a day in your life."
 
T

Tia

Tia,
    I think you are trying to say that you have break during the day,
within the day start D/T and the day end D/T.
    I'll just work with the times here... but you can use your DateTime
values.
Example
DayStart      BreakStart     BreakStop     WorkStop
9:00 am        12:00 pm        1:30 pm          4:00 pm

Determine the minutes between DayStart and DayEnd, and subtract the
difference between BreakStart and BreakEnd, and divide by 60 to get
hours.

=(DateDiff("n",DayStart,DayEnd) - DateDiff("n",BreakStart,BreakEnd)) /60

The above values would yield (420 mins - 90mins) / 60 = 5.5 hrs
--
    hth
    Al Campagna
    Microsoft Access MVP
   http://home.comcast.net/~cccsolutions/index.html

    "Find a job that you love... and you'll never work a day in your life."







- Show quoted text -

I dont know whati am ding wrong, i tried it, but the result was empty
the format is under short time
TOTAL WORKING HOURS PER DAY: (DateDiff("n",[TIME IN],[TIME OUT])-
DateDiff("n",[TIME IN 2],[TIME OUT 2]))/60
Time IN: 5:00 tim out : 19 tim in 2 :20:00 time out2 : 23:00 i tried
to put 25 but i was not able to do so

THank you for your help
 
A

Al Campagna

Tia,
If the person responding to your question top-posts, please do
the same, so we can see the flow of the problem. Mixing top and
bottom posting makes the problem very difficult to follow.

First... describe in detail, each of the fields you have in your
table. (related to this time keeping)
For example... do you have a WorkStartDate field, and a separate
WorkStartTime field?
BreakStartDate and BreakStartTime?
BreakEndDate and BreakEndTime
WorkEndDate and WorkEndTime?

If your times can span over one day, then you need to capture the Date
and the Time, in order to correctly determine the difference in hours.
If your fileds are separated... (each all on one line)
Total Hours = (DateDiff("n",WorkStartDate + WorkStartTime) -
DateDiff("n",WorkEndDate + WorkEndTime)/60
BreakHours = (DateDiff("n",BreakStartDate + BreakStartTime) -
DateDiff("n",BreakEndDate + BreakEndTime)/60
HoursWorked = TotalHours - BreakHours
--
hth
Al Campagna
Microsoft Access MVP
http://home.comcast.net/~cccsolutions/index.html

"Find a job that you love... and you'll never work a day in your life."


Tia,
I think you are trying to say that you have break during the day,
within the day start D/T and the day end D/T.
I'll just work with the times here... but you can use your DateTime
values.
Example
DayStart BreakStart BreakStop WorkStop
9:00 am 12:00 pm 1:30 pm 4:00 pm

Determine the minutes between DayStart and DayEnd, and subtract the
difference between BreakStart and BreakEnd, and divide by 60 to get
hours.

=(DateDiff("n",DayStart,DayEnd) - DateDiff("n",BreakStart,BreakEnd)) /60

The above values would yield (420 mins - 90mins) / 60 = 5.5 hrs
--
hth
Al Campagna
Microsoft Access MVP
http://home.comcast.net/~cccsolutions/index.html

"Find a job that you love... and you'll never work a day in your life."







- Show quoted text -

I dont know whati am ding wrong, i tried it, but the result was empty
the format is under short time
TOTAL WORKING HOURS PER DAY: (DateDiff("n",[TIME IN],[TIME OUT])-
DateDiff("n",[TIME IN 2],[TIME OUT 2]))/60
Time IN: 5:00 tim out : 19 tim in 2 :20:00 time out2 : 23:00 i tried
to put 25 but i was not able to do so

THank you for your help
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top