View Full Version : Now() date problem.
Morgoth
12-01-2002, 01:03 AM
I have the line:
ssSQL = "UPDATE tblMembers SET Loggedin='" & Now() & "' WHERE (ID=" & oRS("ID") & ")"
Response.Write(ssSQL) : Response.End
in my code
The result of this is:
UPDATE tblMembers SET Loggedin='11/30/2002 7:06:36 PM' WHERE (ID=1)
That's all correct!
But inside the db the field Loggedin says:
Friday, December 29, 1899 12:00:00 AM
Why?
I am at a complete loss!!!
Morgoth
12-01-2002, 01:04 AM
If anyone has a better method then this to add the date to a database, I would like to hear it.
whammy
12-01-2002, 01:10 AM
You using Access? If so you have to use # around dates, not '.
Morgoth
12-01-2002, 01:17 AM
I am using Access, and that's not changing it.
If I change ' to # on both sides, it still gives me that odd date.
Friday, December 29, 1899
12:00:00 AM
:(
Mhtml
12-01-2002, 02:04 AM
Try putting the individual date parts in separately,
like use date() and time() instead of now() it shouldn't make a difference but I can't see why your current one will not work.
whammy
12-01-2002, 02:08 AM
Have you actually executed the SQL statement? i.e.:
Conn.Execute(ssSQL)
P.S. If you don't comment out Response.End anything after that in your code will not execute...
Morgoth
12-01-2002, 04:18 AM
Don't worry, I solved the problem It was changing my response to a null date.
Dec 29, 1899
jan 1, 1900
It was a big error with me mixing 2 types of datatypes by mistake.
:(
I am n00b hear me whine..
whammy
12-01-2002, 04:23 AM
Yeah, that's usually one of my troubleshooting steps...
1. Option Explicit (Option Strict in .Net looks awesome)
2. Response.Write to see what's going on
3. VarType(variable)
Not necessarily in that order... but I have wasted a lot of time looking at useless stuff when I should have followed some debugging practices like this. Getting better at it now. :)
Mhtml
12-01-2002, 04:36 AM
I forgot to say to check for that...
I think vbscript is very powerful in the date/time department.
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.