Results 1 to 7 of 7
  1. #1
    spleewars is offline Novice
    Windows XP Access 2002
    Join Date
    Feb 2012
    Posts
    26

    datediff wrong values

    in the query i got "in" and "out" and both are short time values



    i wrote this formula to calculate the time between IN and OUT:

    total: ROUND(datediff("n",[in],[out]/60,2)

    but the values are not resolving right: eg: between 20:07 and 20:28 is giving me 0.35...

    what is wrong?

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,641
    Why are you dividing the out time by 60?
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    spleewars is offline Novice
    Windows XP Access 2002
    Join Date
    Feb 2012
    Posts
    26
    actually i forgot to put a bracket: actually its -

    total: ROUND(datediff("n",[in],[out])/60,2)

    ... and still resolving wrong

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,641
    Why are you dividing by 60 at all? 21 minutes divided by 60 is .35, so you're getting an accurate answer.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    spleewars is offline Novice
    Windows XP Access 2002
    Join Date
    Feb 2012
    Posts
    26
    i am dividing by 60 to have a total hours/minutes without exceeding '60'... any better suggestion?

  6. #6
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,641
    Is the Mod function what you're looking for?
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  7. #7
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,641
    Apparently it was, given your new thread, so I'll mark this one solved.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Datediff()
    By st1300 in forum Programming
    Replies: 6
    Last Post: 12-08-2011, 05:58 PM
  2. DateDiff
    By mrkaye in forum Forms
    Replies: 18
    Last Post: 11-19-2010, 08:19 AM
  3. DateDiff
    By ROB in forum Access
    Replies: 2
    Last Post: 10-30-2010, 03:58 AM
  4. How to use DateDiff?
    By teirrah1995 in forum Queries
    Replies: 10
    Last Post: 10-19-2010, 12:07 PM
  5. Datediff
    By greggue in forum Queries
    Replies: 2
    Last Post: 08-13-2010, 03:53 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums