Share via

Date Difference in Access Query

Anonymous
2022-11-30T07:46:31+00:00

Hi

I have Time In and Time Out in my table

i want to calculate the total Hours between Time In & Out. I am using the following expression.

(DateDiff("n",[TimeIn],[TimeOut])\6)/10

Suppose my Time In is 16:00 and time out is 00:00

It gives -16 but the actual Hours are 8.

How can i calculate this?

I think it is due to the change of date. But how to resolve this problem i have no idea.

Please Help

Thanks in Advance

Atif Mahmood

Microsoft 365 and Office | Access | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

Answer accepted by question author

Anonymous
2022-11-30T08:43:45+00:00

Check, and correct for, if Time Out is earlier than Time In:

Hours = (DateDiff("n", [TimeIn], Abs(DateAdd("d", [TimeIn] >= [TimeOut], [TimeOut]))) \ 6) / 10

Was this answer helpful?

1 person found this answer helpful.
0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Anonymous
    2022-11-30T08:53:10+00:00

    Thanks, it worked

    Was this answer helpful?

    0 comments No comments