Answered
DateTime issues w/ Coldfusion/MySQL
I am having a BIG problem and have not been able to find any
help so far. I am not sure if this is a Coldfusion issue or a MySQL
issue, but I figured enough people use MySQL i cannot be the only
one that has had this problem...
I have some code that updates a field in my database with the current date/time upon logging into the site:
<cfquery datasource="dsn">
UPDATE users
SET userLastLogin = "#LSDateFormat(Now(),"yyyy-mm-dd")# #LSTimeFormat(Now(),"HH:mm:ss")#"
WHERE userID = #login.userID#
</cfquery>
This happens and when I look in my database I will see: 2008-07-02 17:12:33
But when I use cfquery and get a list of users I cannot use LSTimeFormat or TimeFormat on the value of this field because it returns this: 2008-07-02 17:12:33.0
I can use LSDateFormat and DateFormat, but if I do anything pertaining to the time I get:
'' is an invalid time format.
Any clues? I really need to get this figured out so all help is greatly appreciated! THANKS!
I have some code that updates a field in my database with the current date/time upon logging into the site:
<cfquery datasource="dsn">
UPDATE users
SET userLastLogin = "#LSDateFormat(Now(),"yyyy-mm-dd")# #LSTimeFormat(Now(),"HH:mm:ss")#"
WHERE userID = #login.userID#
</cfquery>
This happens and when I look in my database I will see: 2008-07-02 17:12:33
But when I use cfquery and get a list of users I cannot use LSTimeFormat or TimeFormat on the value of this field because it returns this: 2008-07-02 17:12:33.0
I can use LSDateFormat and DateFormat, but if I do anything pertaining to the time I get:
'' is an invalid time format.
Any clues? I really need to get this figured out so all help is greatly appreciated! THANKS!
