Solved

DateDiff function pulling wrong time duration

Posted on 2008-10-26
4
323 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
  • 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

If you have heard of RFC822 date formats, they can be quite a challenge in SQL Server. RFC822 is an Internet standard format for email message headers, including all dates within those headers. The RFC822 protocols are available in detail at:   ht…
It’s been over a month into 2017, and there is already a sophisticated Gmail phishing email making it rounds. New techniques and tactics, have given hackers a way to authentically impersonate your contacts.How it Works The attack works by targeti…
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

820 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