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. :)
Printable View
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:Quote:
Originally Posted by thegreatone
VB Code:
Debug.print DateDiff("s", "04/18/2005 17:51", Now)
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)
Thanks for the help, i need a good look at the built in functions of VB6, nw where i can find any ?
MSDN.MICROSOFT.COm
Wow, i well and truly forgot about that one, lol
Plus, i think you had an arguement with Caps Lock there mate. lol
Thanks.
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:Quote:
Originally Posted by moinkhan
So, if he needs the elapsed seconds... if ElapsedSeconds = 0 => they're the same. And you have the elapsed time already.Quote:
Originally Posted by thegreatone
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..Quote:
Originally Posted by Mc Brain
The only function that's 100% is DateSerial... of course, that might be because you have to explicitily set the Year, Month and Day separately. It would be very stupid if the function mixed the values once you've just told it which value correspond to each other.