The following should work for both Access and SQL Server.
Since Now() is already in ODBC format, inserting it is dead simple:
<CFQUERY NAME="qryInsertDateTime" DATASOURCE="some_dsn">
INSERT INTO some_table (column_name)
VALUES (#Now()#)
</CFQUERY>
For any other date, just use either of the following methods you're most
comfortable with (there are, of course, other ways of doing this, as
always... ;)):
<CFSET theDateToInsert = #CreateODBCDateTime(some_date)#
<CFQUERY NAME="qryInsertDateTime" DATASOURCE="some_dsn">
INSERT INTO some_table (column_name)
VALUES (#theDateToInsert#)
</CFQUERY>
OR:
<CFQUERY NAME="qryInsertDateTime" DATASOURCE="some_dsn">
INSERT INTO some_table (column_name)
VALUES (#CreateODBCDateTime(theDateToInsert)#)
</CFQUERY>
OR:
<CFQUERY NAME="qryInsertDateTime" DATASOURCE="some_dsn">
INSERT INTO some_table (column_name)
VALUES (#DateFormat(theDateToInsert, 'mm/dd/yyyy' [or whatever mask you
wish to use])#)
</CFQUERY>
Cheers,
--
David
----------------------------
> -----Original Message-----
> From: Denny dd [mailto:[EMAIL PROTECTED]]
> Sent: Saturday, April 29, 2000 1:46 PM
> To: [EMAIL PROTECTED]
> Subject: RE: RE: Unable To insert Proper Date
>
>
> Hi!
> I was also trying the same thing but instead of using
> datatype "date/time" for
> the field Date was using "text" with which it is working.Can
> you please give
> an example as where and when to use "CreateODBCDate" for
> inserting current
> date into access database.
>
------------------------------------------------------------------------------
Archives: http://www.eGroups.com/list/cf-talk
To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.