PDA

Click to See Complete Forum and Search --> : Comparing times in ASP


glitch13
Dec 12th, 2000, 04:00 PM
how would you (in vbscript) compare times like this:



if (time1 - time2) > 60minutes then

code code code code code code code

end if

so basically i want to do something only if the 2 times are less then 1 hour apart.

thanks in advance for any help.

Dec 12th, 2000, 04:25 PM
You could use the DateDiff() function with a minutes ("n") interval like so:


If DateDiff("n", datetime1, datetime2) < 60 Then
' Do your code here.
End if


Paul

PS - Edited to change 'minuetes' to 'minutes' - geez. :P

[Edited by PWNettle on 12-12-2000 at 06:08 PM]

glitch13
Dec 12th, 2000, 05:04 PM
thanks! worked perfectly!