Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

total working hours

0 views
Skip to first unread message

Tia

unread,
Nov 11, 2009, 4:15:50 AM11/11/09
to
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

Douglas J. Steele

unread,
Nov 11, 2009, 6:38:58 AM11/11/09
to
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 MVP
http://I.Am/DougSteele
(no e-mails, please!)


"Tia" <tia.abd...@gmail.com> wrote in message
news:88aafbdd-c511-491a...@b25g2000prb.googlegroups.com...

Tia

unread,
Nov 11, 2009, 8:17:02 AM11/11/09
to
On Nov 11, 3:38 am, "Douglas J. Steele"

<NOSPAM_djsteele@NOSPAM_gmail.com> wrote:
> 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!)
>
> "Tia" <tia.abdelka...@gmail.com> wrote in message

>
> news:88aafbdd-c511-491a...@b25g2000prb.googlegroups.com...
>
>
>
> > 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- Hide quoted text -
>
> - 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

Al Campagna

unread,
Nov 11, 2009, 8:29:24 AM11/11/09
to
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."


"Tia" <tia.abd...@gmail.com> wrote in message
news:88aafbdd-c511-491a...@b25g2000prb.googlegroups.com...

Tia

unread,
Nov 11, 2009, 10:01:21 AM11/11/09
to
On Nov 11, 5:29 am, "Al Campagna" <newsgro...@comcast.net> wrote:
> 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."
>
> "Tia" <tia.abdelka...@gmail.com> wrote in message

>
> news:88aafbdd-c511-491a...@b25g2000prb.googlegroups.com...
>
>
>
> > 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- Hide quoted text -
>
> - 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

Al Campagna

unread,
Nov 11, 2009, 10:27:38 AM11/11/09
to
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" <tia.abd...@gmail.com> wrote in message

news:094bfe02-cc7a-40ad...@j9g2000prh.googlegroups.com...

0 new messages