PDA

View Full Version : DateDiff Question / Help


bulgarian388
11-29-2006, 01:11 AM
Hi All, I am attempting to calculate the difference in minutes between two date.time fields. My Code is like this:

currentDateTime = now()
response.Write(failedLoginDateTime & "<br />")
response.Write(currentDateTime & "<br />")
response.Write(lockOutTime & "<br />")
response.Write(dateDiff("n", formatDateTime(currentDateTime,3), formatDateTime(failedLoginDate,3)) & "<br />")

And this is what comes out when viewed:

11/28/2006 5:18:46 PM
11/28/2006 6:05:37 PM
01:15:00
-1085

Now, I'm not stupid or anything, but doesn't 6:05 - 5:18 = 47 minutes? Then why is my dateDiff function resulting in -1085? Any asistance on how to get a correct value out of this would be greatly appreciated.

P.S. This is for a failed login tracking system.

Thanks in advance

mehere
11-29-2006, 03:28 AM
you're using formatDateTime(failedLoginDate,3) and it should be formatDateTime(failedLoginDateTime,3)

bulgarian388
11-29-2006, 05:17 AM
OFMG!!! I love you!!! :D

Thanks so much, I kind of feel like an r-tard for missing that. Anyway, thanks again. :)