开发者

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

开发者 https://www.devze.com 2023-03-19 08:46 出处:网络
When i save a date using jquery datepicker into oracle with format other than \'yy-mm-dd\' always return tod开发者_StackOverfloway date.

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

精彩评论

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