简体   繁体   中英

Jquery DatePicker: how set date format according to system date format

The default format of jquery datepicker is [MM/dd/yy].Even if i change the system date format like [dd/MM/yyy] datepicker takes a default format ie [MM-dd-yy]. How to set datepicker format according to system datetime format.

Please help me....

Using javascript, the only hint at the used locale seems to be navigator.language , according to Best way to determine user's locale within browser . From Datepicker Widget (search for Localization), you can then use something like

$(selector).datepicker($.datepicker.regional['fr']);

It would be easier to determine the preferred locale from server side, evaluating Accept-Language and send a customized JS file.

There are also examples at Format date and Localize calendar , which lets users pick their preferred format.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM