I'm very new to MySql and I'm having problems inserting dates into my tables (via the Web using Coldfusion). The user can put the following in the field:
12/09/2003 But the data returned from the database is:
2012-09-20 03:00:00.0
<cfquery ...>
INSERT INTO table (field)
VALUES ('2003-12-09')
</cfquery>
The suggestion to use double quotes to delimit a string is an excellent way to lock yourself in into using MySQL for ever. The standard SQL delimiters for a string are single quotes, and it is highly recommended to use those.
It would be even better to use bind variables/cfqueryparam so you can leave all formatting issues to the driver. This will give maximum portability, performance and security:
<cfquery ...>
INSERT INTO table (field)
VALUES (<cfqueryparam cfsqltype="cf_sql_date" value="2003-12-09">)
</cfquery>
Jochem
-- I don't get it immigrants don't work and steal our jobs - Loesje
-- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]