Re: date format fo mySql
Is your field in the db set up as a DATE or DATETIME? Jim Eisenhauer On Fri, Aug 20, 2010 at 9:26 AM, Rob Voyle r...@voyle.com wrote: Hi Folks I have a coldfusion variable expireDate=Dec. 10, 2010 That I want to insert as a date into a mySql database The table cell is set up as a date but I can't find the right cf date format to get the insert to work. I keep getting a syntax error. Thanks Rob Robert J. Voyle, Psy.D. Director, Clergy Leadership Institute For Coaching and Training in Appreciative Inquiry Author: Core Elements of the Appreciative Way http://www.clergyleadership.com/ 503-647-2378 or 503-647-2382 ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:336443 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: date format fo mySql
Where is the date you need to insert coming from as well? A form? and/or is it a literal string like 'Dec. 10, 2010'... or is the form field passing an actual date variable? Jim Eisenhauer On Fri, Aug 20, 2010 at 9:28 AM, Jim Eisenhauer eisenha...@gmail.comwrote: Is your field in the db set up as a DATE or DATETIME? Jim Eisenhauer On Fri, Aug 20, 2010 at 9:26 AM, Rob Voyle r...@voyle.com wrote: Hi Folks I have a coldfusion variable expireDate=Dec. 10, 2010 That I want to insert as a date into a mySql database The table cell is set up as a date but I can't find the right cf date format to get the insert to work. I keep getting a syntax error. Thanks Rob Robert J. Voyle, Psy.D. Director, Clergy Leadership Institute For Coaching and Training in Appreciative Inquiry Author: Core Elements of the Appreciative Way http://www.clergyleadership.com/ 503-647-2378 or 503-647-2382 ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:336444 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: date format fo mySql
On Fri, Aug 20, 2010 at 12:26 PM, Rob Voyle r...@voyle.com wrote: Hi Folks I have a coldfusion variable expireDate=Dec. 10, 2010 That I want to insert as a date into a mySql database The table cell is set up as a date but I can't find the right cf date format to get the insert to work. I keep getting a syntax error. #1 - are you using cfqueryparam to do the insert? #2 - To help us fix the error, it would be helpful to see the full error text as well as the code that is generating it. ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:336445 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: date format fo mySql
CreateODBCDate(expireDate) or CreateODBCDateTime(expireDate) On Fri, Aug 20, 2010 at 12:26 PM, Rob Voyle r...@voyle.com wrote: Hi Folks I have a coldfusion variable expireDate=Dec. 10, 2010 That I want to insert as a date into a mySql database The table cell is set up as a date but I can't find the right cf date format to get the insert to work. I keep getting a syntax error. Thanks Rob Robert J. Voyle, Psy.D. Director, Clergy Leadership Institute For Coaching and Training in Appreciative Inquiry Author: Core Elements of the Appreciative Way http://www.clergyleadership.com/ 503-647-2378 or 503-647-2382 ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:336447 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: date format fo mySql
Rick is right. Use cfqueryparam and your problems will go away: INSERT INTO xTable(xDate) VALUES (cfqueryparam value=Dec. 10, 2010 cfsqltype=cf_sql_date /); That's for a DATE column. If you are doing a DATETIME column, use cf_sql_timestamp instead. Rick Root wrote: On Fri, Aug 20, 2010 at 12:26 PM, Rob Voyle r...@voyle.com wrote: Hi Folks I have a coldfusion variable expireDate=Dec. 10, 2010 That I want to insert as a date into a mySql database The table cell is set up as a date but I can't find the right cf date format to get the insert to work. I keep getting a syntax error. #1 - are you using cfqueryparam to do the insert? #2 - To help us fix the error, it would be helpful to see the full error text as well as the code that is generating it. ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:336448 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: date format fo mySql
wierd, my first reply didn't go through... Rick is right. Use cfqueryparam and your problems will go away: INSERT INTO xTable(xDate) VALUES (cfqueryparam value=Dec. 10, 2010 cfsqltype=cf_sql_date /); That's for a DATE column. If you are doing a DATETIME column, use cf_sql_timestamp instead. You can also use Michael Grant's method by converting it first to an ODBCDATE/DATETIME formatted object Rick Root wrote: #1 - are you using cfqueryparam to do the insert? #2 - To help us fix the error, it would be helpful to see the full error text as well as the code that is generating it. ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:336449 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm