Solved

DateDiff function pulling wrong time duration

Posted on 2008-10-26
4
327 Views
Last Modified: 2013-11-27
In my query Im attempting to calculate the exact time duration from clockin to clockout

I'm using this function to calculate the Duration field:
Duration: DateDiff("h"[clock_in_datetime],[clock_out_datetime])

The output for this is round numbers.  Is this avoidable?  I need the increments as well.

Clock_In_Datetime         Clock_Out_Datetime      Duration
9/3/2008 2:25:00 PM       9/3/2008 7:27:00 PM     5.00
9/3/2008 5:00:00 PM       9/3/2008 7:39:00 PM      2.0                                                                                
9/3/2008 5:03:00 PM       9/3/2008 8:22:00 PM      3.00
9/3/2008 5:13:00 PM       9/3/2008 8:27:00 PM      3.00
9/3/2008 6:35:00 PM       9/3/2008 10:14:00 PM    4.00                          
9/3/2008 8:11:00 PM       9/4/2008 1:34:00 AM      5.00

thanks



0
Comment
Question by:Cole100
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 46

Expert Comment

by:tbsgadi
ID: 22806543
Hi Cole100,

You can use minutes "n"
http://www.techonthenet.com/access/functions/date/datediff.php

Good Luck!

Gary
0
 
LVL 22

Accepted Solution

by:
dportas earned 200 total points
ID: 22806549
DATEDIFF counts the number of time "ticks" between the two times in whatever sized units you specify. So if you want to be more precise you could select the units to be minutes or seconds and then divide the result by 60 or 3600.
0
 

Author Comment

by:Cole100
ID: 22806550
Using "n" gets total minutes.  I need hours rounded to the .1

clockin      clockout     duration (hrs)
4:00pm      8:30pm           4.5

thank you.

0
 

Author Comment

by:Cole100
ID: 22806557
dportas:

I should have caught that.  Thanks very much.  That got it.

0

Featured Post

Containers & Docker to Create a Powerful Team

Containers are an incredibly powerful technology that can provide you and/or your engineering team with huge productivity gains. Using containers, you can deploy, back up, replicate, and move apps and their dependencies quickly and easily.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

617 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question