DateDiff

  • Thread starter Thread starter Guest
  • Start date Start date
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?
 
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])
 
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]
 
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 ! >
 
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 >
 
Back
Top