Results 1 to 5 of 5

Thread: Calculate time difference

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2002
    Location
    Pakistan
    Posts
    436

    Calculate time difference

    Dear friends

    I want to calculate difference b/w two times:

    Thanks

  2. #2
    PowerPoster
    Join Date
    Dec 2003
    Posts
    4,787

    Re: Calculate time difference

    Quote Originally Posted by zubairkhan
    Dear friends

    I want to calculate difference b/w two times:

    Thanks
    Please where possible allways search the forums

    This should help you out,
    http://www.vbforums.com/showthread.p...light=datediff

    If not post back

  3. #3
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: Calculate time difference

    use the DateDiff function

    elapsedminutes =DateDiff("n",time1,time2)

    rgds pete

  4. #4

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2002
    Location
    Pakistan
    Posts
    436

    Re: Calculate time difference

    with datediff function the output comes on the basis of 10 base
    suppose i have first time is 9:55 and second time is 8:15, datediff function returns 620 , divide it by 60 = 10.33, which is wrong ansower should be 10:40

  5. #5
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: Calculate time difference

    with datediff function the output comes on the basis of 10 base
    suppose i have first time is 9:55 and second time is 8:15, datediff function returns 620 , divide it by 60 = 10.33, which is wrong ansower should be 10:40
    of course it is the correct answer for what you did. the answer is actually 10 hrs 20 mins,

    the calculation to get this is:-

    VB Code:
    1. dd = DateDiff("n", "9:55", "20:15")
    2. dd = dd \ 60 & ":" & dd Mod 60
    rgds pete

Posting Permissions

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



Click Here to Expand Forum to Full Width