开发者

error while inserting mm-dd-yyyy date in mysql in coldfusion

i have a problem while inserting the date format like mm/dd/yyyy in mySQL.

It is showing the date format error.and my requirement is to enter开发者_运维技巧 like this format from front-end(coldfusion) and i am using mySQL5 as database.

any help would be greatly appriaciated.

Thanks

Yugal


Make sure the date to save is a valid date and either use CreateODBCDate(yourDate) or CreateODBCDateTime(yourDate) or better let <cfqueryparam> do the work for you

INSERT into myTable
(myDate)
VALUES
(<cfqueryparam cfsqltype="cf_sql_date" value="#yourDate#">)


Make sure you're entering dates in date columns and not string values, as the default cast of string --> date in the database could change at any time.

e.g.

insert into TableX (myDateCol) SELECT STR_TO_DATE('01,5,2013','%d,%m,%Y') ...

and not

insert into TableX (myDateCol) SELECT '05/01/2013' ...

or however that is constructed in coldfusion.


I think you have to mention which format you are giving.

Insert into table TABLE values(XX,'TO_DATE('03-10-92','MM-DD-YY')',XXXXX);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜