开发者

jquery datePicker: oracle won't accept other than dateFormat:'yy-mm-dd'

When i save a date using jquery datepicker into oracle with format other than 'yy-mm-dd' always return tod开发者_StackOverfloway date. Does anyone know why? is there something in oracle or jquery that i must know? many thank...


jQuery doesn't have a date picker. If you're using the jQuery UI datepicker, you can tell it what the date format is via the dateFormat and altFormat options.

But it sounds as though you're passing the output of the datepicker straight through to your database layer. Be sure that you're formatting the date correctly for the DB, ideally through a "date" style parameter (not string/varchar) in whatever DB connection layer you're using. In particular, it's important not to just pass the text sent from the client-side into the DB directly; you need to parse or at least validate the date in the mid-tier to prevent SQL injection attacks.


To format date (of the jQuery UI datepicker) for use in Oracle, please add the following configuration.

dateFormat: "dd-M-yy"
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜