Results 1 to 4 of 4

Thread: Time Difference?

  1. #1

    Thread Starter
    PowerPoster Static's Avatar
    Join Date
    Oct 2000
    Location
    Rochester, NY
    Posts
    9,390

    Time Difference?

    How can I figure out the difference between 2 times...

    even taking in to account if time A is the day or 2 days before?

    7/1/2004 4:50:38 PM
    7/2/2004 10:02:22 AM

    ??

    thanks
    JPnyc rocks!! (Just ask him!)
    If u have your answer please go to the thread tools and click "Mark Thread Resolved"

  2. #2
    PowerPoster RhinoBull's Avatar
    Join Date
    Mar 2004
    Location
    New Amsterdam
    Posts
    24,132
    VB Code:
    1. Private Sub Command1_Click()
    2. Dim sTime1$, sTime2$
    3.  
    4.     sTime1 = "7/1/2004 4:50:38 PM"
    5.     sTime2 = "7/2/2004 10:02:22 AM"
    6.    
    7.     Debug.Print DateDiff("d", sTime1, sTime2) 'days
    8.     Debug.Print DateDiff("n", sTime1, sTime2) 'minutes
    9.  
    10. End Sub

  3. #3

    Thread Starter
    PowerPoster Static's Avatar
    Join Date
    Oct 2000
    Location
    Rochester, NY
    Posts
    9,390
    d*mn! thats what I forgot...
    add the date into the datediff!

    DUH!

    Thanks man!
    JPnyc rocks!! (Just ask him!)
    If u have your answer please go to the thread tools and click "Mark Thread Resolved"

  4. #4
    PowerPoster RhinoBull's Avatar
    Join Date
    Mar 2004
    Location
    New Amsterdam
    Posts
    24,132
    Any time.

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