I always use the following function when inserting dates/times into sql. CreateODBCDateTime() CreateODBCDate() CreateODBCTime()
-- Shaun Webster 480 Broadway Suite 328, Saratoga Springs NY 12866 office: 518.632.4333 | mobile: 518.269.2132 | fax: 518.490.1236 [email protected] | www.webvalve.com ------------------------------------------------------ This email, and any files transmitted with it, is confidential and intended solely for the use of the individual or entity to whom it is addressed. ------------------------------------------------------ On May 17, 2010, at 1:56 PM, Scott Brady wrote: > > Well, it looks like I can leave the field as a datetime but just use > cf_sql_timetamp in the queryparams. > > I'd still like to know if there's a better way, but it's a lot easier to > search and replace that than to change every field in the database. > > Scott > > On Mon, May 17, 2010 at 11:48 AM, Scott Brady <[email protected]> wrote: > >> I'm running into an issue I'm hoping others have seen. >> >> We have a number of fields that need to be date times, and I'm getting this >> type of error when trying to enter them into the database: >> Data truncation: Incorrect datetime value: '{ts '2010-05-17 11:40:23'}' for >> column 'modified' at row 1 >> >> If I change them to a time stamp (and set the sql type in the param to >> cf_sql_timestamp) it works -- though, I'm not looking forward to changing >> every single table that has these fields in them. If I just leave the field >> alone and change it to cf_sql_date, it works (though, as expected, doesn't >> put the time part of the date time in there). >> >> Is there some weirdness with ColdFusion date time objects and mySQL >> datetime fields? (this is ColdFusion 9 and mySQL 5) >> >> I could go through and change all of the fields to timestamps (except for >> things like birthdate, but that can be just "date", since I believe >> timestamp won't work for dates before 1970), but was hoping for an easier >> option. >> >> Thanks! >> >> Scott >> >> -- >> ----------------------------------------- >> Scott Brady >> http://www.scottbrady.net/ >> > > > > -- > ----------------------------------------- > Scott Brady > http://www.scottbrady.net/ > > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| 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:333767 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

