Results 1 to 3 of 3
  1. #1
    Join Date
    Nov 2003
    Posts
    300

    Question Unanswered: Help with Time difference

    I have the following calc:

    =Format(Int((DateDiff("n",[Receive Time],[Deliver Time]))/60),0) & " Hours and " & Format(Int((DateDiff("n",[Receive Time],[Deliver Time])))-(Int((DateDiff("n",[Receive Time],[Deliver Time]))/60)*60),0) & " Minutes"

    It works great when calculating the time diff within one day, however if the receive date is yesterday and the deliver date is today, it will give a negative # and it will be incorrect.

    Any help is appreciated..

  2. #2
    Join Date
    May 2005
    Posts
    150
    First thing I would do is check the number of days difference using the datediff

    then I would take the result of that and multiply by 24

    then take the Currenttime and subtract it from 12:00

    and finally add the two together...

    the code for this is fairly simple so give it a shot let me know if you need anymore help

  3. #3
    Join Date
    Mar 2003
    Location
    The Bottom of The Barrel
    Posts
    6,102
    Provided Answers: 1
    What is the real-world business model you are trying to support? What result to you expect to see? At first glance, i would say it's difficult to to receive something before it's been delivered...

    Oh, and uh... have a look at the Abs() function... The modulo operator (%) is useful for pulling minutes as well...
    oh yeah... documentation... I have heard of that.

    *** What Do You Want In The MS Access Forum? ***

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •