|
-
Apr 18th, 2005, 03:49 PM
#1
Thread Starter
Frenzied Member
Compare Date/Time Elapsed... [resolved]
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.
Last edited by thegreatone; Apr 19th, 2005 at 02:05 PM.
Zeegnahtuer?
-
Apr 18th, 2005, 03:51 PM
#2
Need-a-life Member
Re: Compare Date/Time Elapsed...
 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:
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.
-
Apr 18th, 2005, 04:51 PM
#3
Re: Compare Date/Time Elapsed...
Just convert the value and then compare it.
VB Code:
dim hardcoded as date
hardcoded = cdate("04/18/2005 17:51")
Debug.print DateDiff("s", hardcoded , Now)
-
Apr 19th, 2005, 11:31 AM
#4
Thread Starter
Frenzied Member
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 ?
-
Apr 19th, 2005, 01:16 PM
#5
Frenzied Member
Re: Compare Date/Time Elapsed... [resolved, one last bit though...]
-
Apr 19th, 2005, 02:04 PM
#6
Thread Starter
Frenzied Member
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.
-
Apr 19th, 2005, 02:18 PM
#7
Frenzied Member
Re: Compare Date/Time Elapsed... [resolved]
Just wondering Why can't you just use conditional operator to compare the dates?
VB Code:
If format("04/18/2005 17:51","mm/dd/yyyy hh:mm") = format(now,"mm/dd/yyyy hh:mm") Then
......
End If
-
Apr 19th, 2005, 02:29 PM
#8
Need-a-life Member
Re: Compare Date/Time Elapsed... [resolved]
 Originally Posted by moinkhan
Just wondering Why can't you just use conditional operator to compare the dates?
VB Code:
If format("04/18/2005 17:51","mm/dd/yyyy hh:mm") = format(now,"mm/dd/yyyy hh:mm") Then
......
End If
Because he said:
 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.
-
Apr 19th, 2005, 02:42 PM
#9
Frenzied Member
Re: Compare Date/Time Elapsed... [resolved]
 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..
-
Apr 19th, 2005, 03:47 PM
#10
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|