How to change date format in jquery date picker?

Hi, I use the date picker when choosing a date when the date is displayed in this format month / date / year .... How to convert the date to this format in the format year-month-date in the js date command itself

+3
source share
2 answers

Date.firstDayOfWeek = 0; Date.format = 'yyyy-mm-dd'; $ (Function () {$ ('Date Choice'). Datepicker ()});

+1
source

This will apply the date format for all date pickers created after:

$.datepicker.setDefaults({
    dateFormat: 'dd.mm.yy'
});

Or apply to a specific date:

$('#selector').datepicker({
    dateFormat: 'dd.mm.yy'
});
+1
source

Source: https://habr.com/ru/post/1747945/


All Articles