DateDiff

G

Guest

I'm trying to calculate the number of hours between two times. This is for a
time clock program, so if worker works over midnight, he/she will end up with
negative hours when I use the DateDiff function. I have the dates logged but
they are values in separate fields. How can I work around this? Could I do
a conditional statement that says, if the value that the DateDiff functions
returns is negative, take the absolute value of that value from 24?
 
K

Ken Snell [MVP]

As you're already storing the date values as well, just add the date and
time values to do the subtractions:

ElapsedTime=DateDiff("n", [StartDate]+[StartTime], [EndDate]+[EndTime])
 
J

John Vinson

How did you know the exact name of my fields? d8^) <--guy w/ sunglasses and
hat

"Who knows what evil lurks in the hearts of posters' databases? The
Shadow knows!" (Ken looks great in a fedora and cape)

John W. Vinson[MVP]
 
K

Ken Snell [MVP]

John Vinson said:
"Who knows what evil lurks in the hearts of posters' databases? The
Shadow knows!" (Ken looks great in a fedora and cape)


< big grin ! >
 
K

Ken Snell [MVP]

Actually, the question is, how did you know that I would use these specific
names in my post, and thus designed your table that way in the first place!?

< g >
 

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