For your cfqueryparam, cf_sql_date will insert literally only the date into the database - instead, use cf_sql_timestamp.
nathan strutz [Blog and Family @ http://www.dopefly.com/] [AZCFUG Manager @ http://www.azcfug.org/] On Mon, May 11, 2009 at 12:37 PM, fun and learning <funandlrnn...@gmail.com>wrote: > > Hello All, > > I have an issue inserting date and time together into a database table from > coldfusion. > > Right now, I am using <cfquery> to get records from a particular table, in > which one of the field is date, and its value in the database is something > like > "2/14/2007 9:10:12 AM". I am performing insert operation into another table > which has to insert this date field into the column of new table. I am doing > currently as follow: > > <cfquery name="getDate" datasource="" maxrows="1"> > select date_field from table > </cfquery> > > <cfif getDate.recordcount is not 0> > <cfquery name="insertDate" datasource=""> > insert into table2 (date_field1) values (<cfqueryparam > cfsqltype="cf_sql_date" value=#getDate.date_field#>) > </cfquery> > </cfif> > > The problem with this is only the date is getting inserted but not the > time. How to format this. > > It would be great if somebody can reply, I am not sure if my messages are > getting posted, as I posted couple of issues I had some time back, but never > got any reply back. > > Thanks. > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lists Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:322377 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4