Help! Calculating Date/Time

G

Guest

Hi I need help figuring out how to calculate time like a time tracking
timeclock. I have the necessary table and fields already made out with data.
Is there a way to calculate the time (i.e. the difference between clocking
out and clocking in)? Are there any suggestions on how I should go about
this? Please I need all the feedback and help I can get.
thanks
 
G

Guest

This will give you the difference in minutes --
DateDiff("n",[clocking out], [clocking in])
 
G

Guest

Where would I enter this information?

KARL DEWEY said:
This will give you the difference in minutes --
DateDiff("n",[clocking out], [clocking in])

Brandon Y said:
Hi I need help figuring out how to calculate time like a time tracking
timeclock. I have the necessary table and fields already made out with data.
Is there a way to calculate the time (i.e. the difference between clocking
out and clocking in)? Are there any suggestions on how I should go about
this? Please I need all the feedback and help I can get.
thanks
 
J

John Vinson

Where would I enter this information?

KARL DEWEY said:
This will give you the difference in minutes --
DateDiff("n",[clocking out], [clocking in])

Put the expression in a vacant Field cell in a query; or precede it by
an = sign and use it as the Control Source of a textbox on a form or
report.

John W. Vinson[MVP]
 
G

Guest

In the design view of your query add in a blank column, FIELD row --
Time Duration: DateDiff("n",[clocking out], [clocking in])

Brandon Y said:
Where would I enter this information?

KARL DEWEY said:
This will give you the difference in minutes --
DateDiff("n",[clocking out], [clocking in])

Brandon Y said:
Hi I need help figuring out how to calculate time like a time tracking
timeclock. I have the necessary table and fields already made out with data.
Is there a way to calculate the time (i.e. the difference between clocking
out and clocking in)? Are there any suggestions on how I should go about
this? Please I need all the feedback and help I can get.
thanks
 
G

Guest

Well let me explain what I have and maybe you can help me out in the same
terms or give me any feedback on how I should go about doing this...
I have a table set up for ID#, Activity, Clock-In (check box), Clock-Out
(check box), and Timestamp (=now()). How can I take each entry of the
timestamp and figure out the difference in time to calculate the wage? The
main issue is getting the calculations for total hours worked in a day, week,
month.

Thank you all for your help. I can feel that I am almost to a solution.

John Vinson said:
Where would I enter this information?

KARL DEWEY said:
This will give you the difference in minutes --
DateDiff("n",[clocking out], [clocking in])

Put the expression in a vacant Field cell in a query; or precede it by
an = sign and use it as the Control Source of a textbox on a form or
report.

John W. Vinson[MVP]
 
J

John Vinson

Well let me explain what I have and maybe you can help me out in the same
terms or give me any feedback on how I should go about doing this...
I have a table set up for ID#, Activity, Clock-In (check box), Clock-Out
(check box), and Timestamp (=now()). How can I take each entry of the
timestamp and figure out the difference in time to calculate the wage? The
main issue is getting the calculations for total hours worked in a day, week,
month.
ok... I thought that the clockout and clockin times were in the same
record. If you need to pull them from different records it's a bit
harder!

You'll need a "Self Join" query to pair each clockin with its
corresponding clockout. This could be tricky - there's nothing in the
database to prevent someone from clocking in Monday morning, not
clocking out at all, clocking in again Tuesday, and clocking out
Tuesday afternoon. This simple query will fail in that case (it will
actually give the employee credit for 32 hours on Monday and 8 hours
on Tuesday for example):

SELECT Table.Timestamp AS TimeIn, Table_1.Timestamp As TimeOut,
DateDiff("n", Table.Timestamp, Table_1.Timestamp) AS TimeOnJob
FROM Table INNER JOIN Table AS Table_1
ON Table.[ID#] = Table_1.[ID#]
WHERE Table.ClockIn = True
AND Table_1.ClockOut = True
AND Table_1.Timestamp = (SELECT Min(X.[Timestamp]) FROM Table AS X
WHERE X.[ID#] = Table.[ID#] AND X.ClockOut = True AND X.Timestamp >
Table.Timestamp)
WHERE Table.Timestamp >= [Enter start date and time:] AND
Table.Timestamp <= [Enter end date and time:]

This rather hairy query (which drastically needs testing, it's off the
top of my head) finds for each Clock_in record the next corresponding
Clock_Out record for that employee, and calculates the time difference
in minutes. Meals and breaks aren't accounted for here, that's another
issue.


John W. Vinson[MVP]
 

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