Results 1 to 10 of 10

Thread: Compare Date/Time Elapsed... [resolved]

Hybrid View

  1. #1
    Need-a-life Member Mc Brain's Avatar
    Join Date
    Apr 2000
    Location
    Buenos Aires, Argentina
    Posts
    6,808

    Re: Compare Date/Time Elapsed...

    Quote Originally Posted by thegreatone
    Can anyone show me how to compare a date and time (that are hardcoded) with the current date and time ?
    And then show the elapsed time in seconds ?

    Any help is greatly appreciated.
    Try this:
    VB Code:
    1. Debug.print DateDiff("s", "04/18/2005 17:51", Now)
    Emiliano F. Martín


    If a post has helped you then please Rate it! (and give the user points he/she deserves by clicking on the image).
    Encourage the person who helped you to keep doing it, and give him the points he deserves.


    MP3 Organizer: Freeware to logically organize all your MP3s.

  2. #2
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: Compare Date/Time Elapsed...

    Just convert the value and then compare it.

    VB Code:
    1. dim hardcoded as date
    2. hardcoded = cdate("04/18/2005 17:51")
    3. Debug.print DateDiff("s", hardcoded , Now)

  3. #3

    Thread Starter
    Frenzied Member thegreatone's Avatar
    Join Date
    Aug 2003
    Location
    Oslo, Norway. Mhz:4800 x12
    Posts
    1,333

    Re: Compare Date/Time Elapsed...

    Thanks for the help, i need a good look at the built in functions of VB6, nw where i can find any ?
    Zeegnahtuer?

  4. #4
    Frenzied Member
    Join Date
    Jan 2000
    Location
    Brooklyn NY USA
    Posts
    1,258

    Re: Compare Date/Time Elapsed... [resolved, one last bit though...]

    MSDN.MICROSOFT.COm

  5. #5

    Thread Starter
    Frenzied Member thegreatone's Avatar
    Join Date
    Aug 2003
    Location
    Oslo, Norway. Mhz:4800 x12
    Posts
    1,333

    Re: Compare Date/Time Elapsed... [resolved, one last bit though...]

    Wow, i well and truly forgot about that one, lol

    Plus, i think you had an arguement with Caps Lock there mate. lol
    Thanks.
    Zeegnahtuer?

  6. #6
    Frenzied Member moinkhan's Avatar
    Join Date
    Jun 2000
    Location
    Karachi, Pakistan
    Posts
    2,011

    Re: Compare Date/Time Elapsed... [resolved]

    Just wondering Why can't you just use conditional operator to compare the dates?

    VB Code:
    1. If format("04/18/2005 17:51","mm/dd/yyyy hh:mm") = format(now,"mm/dd/yyyy hh:mm") Then
    2.  
    3. ......
    4.  
    5. End If

  7. #7
    Need-a-life Member Mc Brain's Avatar
    Join Date
    Apr 2000
    Location
    Buenos Aires, Argentina
    Posts
    6,808

    Re: Compare Date/Time Elapsed... [resolved]

    Quote Originally Posted by moinkhan
    Just wondering Why can't you just use conditional operator to compare the dates?

    VB Code:
    1. If format("04/18/2005 17:51","mm/dd/yyyy hh:mm") = format(now,"mm/dd/yyyy hh:mm") Then
    2.  
    3. ......
    4.  
    5. End If
    Because he said:
    Quote Originally Posted by thegreatone
    ...
    And then show the elapsed time in seconds ?...
    So, if he needs the elapsed seconds... if ElapsedSeconds = 0 => they're the same. And you have the elapsed time already.

    Besides... I would not EVER rely on MS Format function for dates. That function does not always answer correctly (according to the regional settings)
    Emiliano F. Martín


    If a post has helped you then please Rate it! (and give the user points he/she deserves by clicking on the image).
    Encourage the person who helped you to keep doing it, and give him the points he deserves.


    MP3 Organizer: Freeware to logically organize all your MP3s.

  8. #8
    Frenzied Member moinkhan's Avatar
    Join Date
    Jun 2000
    Location
    Karachi, Pakistan
    Posts
    2,011

    Re: Compare Date/Time Elapsed... [resolved]

    Quote Originally Posted by Mc Brain
    Because he said:

    So, if he needs the elapsed seconds... if ElapsedSeconds = 0 => they're the same. And you have the elapsed time already.

    Besides... I would not EVER rely on MS Format function for dates. That function does not always answer correctly (according to the regional settings)
    well... I have experienced that CDate also sometimes formats the date WRONG... like.. takes it d/m/y sometimes.. rather than m/d/y maybe depending upon the regional settings... that's y I always like to format it first..

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