JQuery UI Datepicker date format issue with initial value JQuery UI Datepicker date format issue with initial value jquery jquery

JQuery UI Datepicker date format issue with initial value


$('#datepicker').datepicker('option', 'dateFormat', 'dd-mm-yy');

Year is specified as y for 2 digits and yy for 4 digits, as stated here.


You need a combination of dateFormat and defaultDate options:

$("#datepicker").datepicker({    dateFormat: 'mm/dd/yyyy',    defaultDate: '20/03/2010'});

there are, however, many different ways to specify the default date. I'm not sure what you need so you can reference the API here: http://docs.jquery.com/UI/Datepicker#option-defaultDate.


mm equals minutes not months.
Use dd/MM/yyyy instead.