RickEpnet
asked on
Datetime Field in MySQL 5.0 with Coldfusion
I pull a date / time from the web and populate it to a MySQL table but I am getting the wrong time. I am sure this is something easy but I cannot figure it out.
For Example
Thu, 28 Jan 2010 08:23:00 PST
Will come in at 8PM I assume because of the P in PST. The reason I amuse this because this time populates correctly. Thu, 28 Jan 2010 17:25:43 GMT
Coldfusion timeformat does the same thing.
I am not using timeformat function when I populate the database.
I thought of using the mid() or right() function to strip out the PST but I was hoping for a better idea than that.
For Example
Thu, 28 Jan 2010 08:23:00 PST
Will come in at 8PM I assume because of the P in PST. The reason I amuse this because this time populates correctly. Thu, 28 Jan 2010 17:25:43 GMT
Coldfusion timeformat does the same thing.
I am not using timeformat function when I populate the database.
I thought of using the mid() or right() function to strip out the PST but I was hoping for a better idea than that.
whats the code for "I pull a date / time from the web and populate it to a MySQL" and also for "I am getting the wrong time"
ASKER
This is a Time Zone code. But if you want to ask a Question you should post your own question.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
oops..sorry there is not datetime it's just date
<cfqueryparam cf_sql_type ="date" value="#myDate#"> but it will -handle- datetime values
<cfqueryparam cf_sql_type ="date" value="#myDate#"> but it will -handle- datetime values
ASKER
I use this <cfqueryparam value="#form.storydate#" cfsqltype="CF_SQL_DATE"> I get this
2010-01-28 00:00:00
2010-01-28 00:00:00
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
SidFishes pointed in the right direction but agx gave a complete answer. Thanks!!
> <cfqueryparam cf_sql_type ="datetime" value="#myDate#">
> <cfqueryparam cf_sql_type ="date" value="#myDate#">
For PAQ purposes, I think those are just typos
ie cf_sql_timestamp (instead of datetime) and
cf_sql_date
Note: The values need to be prefaced with "cf_sql_"
> <cfqueryparam cf_sql_type ="date" value="#myDate#">
For PAQ purposes, I think those are just typos
ie cf_sql_timestamp (instead of datetime) and
cf_sql_date
Note: The values need to be prefaced with "cf_sql_"