Consulting

Results 1 to 2 of 2

Thread: Solved: Time Difference between two dates

  1. #1

    Solved: Time Difference between two dates

    Hi,

    I have two dates and need to determine the difference between them.
    e.g.
    6/10/2010 9:15:00 AM
    and
    6/9/2010 8:00:00 AM.

    I want the variable and output to be displayed as hh:mm:ss, so that for instance, a difference would show up as 25:15 and not 1:15.

    [VBA]iDelay = Format(iDelay, "????????") ?[/VBA]


    Thanks,

  2. #2
    Knowledge Base Approver VBAX Guru GTO's Avatar
    Joined
    Sep 2008
    Posts
    3,368
    Location
    There must be a way better way, but for just a display (as it will then be text)..

    A2 holds 6/10/2010 9:15:00 AM
    A3 holds 6/9/2010 8:00:00 AM.

    =TRUNC((A2-A3)*24,0)&":"&ROUND(((((A2-A3)*24)-TRUNC((A2-A3)*24,0))*60),0)

Posting Permissions

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