• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 447
  • Last Modified:

Difference between two times

Hi,

I am using DateDiff in Access 2010 to show the time difference between 2 times.

Minutes: DateDiff("n",[ClockInTime],[ClockOutTime])

The above works fine, unless ClockOut time is after midnight, in which case I get a negative and inaccurate result.

Can anyone tell me how I need to modify this simple query so that when I run it I get the correct results.

Thanks
0
LJShepherd
Asked:
LJShepherd
1 Solution
 
Rgonzo1971Commented:
Hi,

pls try (supposing it cannot be more than 24 hours)

Minutes: DateDiff("n",[ClockInTime],IIf([ClockOutTime]<[ClockInTime],[ClockOutTime]+1,[ClockOutTime]))

Open in new window


Regards
0
 
LJShepherdAuthor Commented:
Brilliant, works perfectly thank you!
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now