jquery datepicker not formatting the date

All I want is for the date to be in dd/mm/yyyy format when it is inserted into the input box but it comes through as the default mm/dd/yyyy. When I insert the date into the input with $("#midmonthstart_"+uid).val(formated); I have read on the API docs that will format it, but I have got something wrong here.

function selectmiddate(uid){
$("#midmonthstart_"+uid).datepicker({
    format:'d/m/Y',
    date: $("#midmonthstart_"+uid).val(),
    current: $("#midmonthstart_"+uid).val(),
    starts: 1,
    position: 'r',
    onBeforeShow: function(){
        $("#midmonthstart_"+uid).DatePickerSetDate($("#midmonthstart_"+uid).val(), true);
    },
    onChange: function(formated, dates){
        $("#midmonthstart_"+uid).val(formated);
        $("#midmonthstart_"+uid).DatePickerHide();
    }
});
}

Answers


You should write :

function selectmiddate(uid){
$("#midmonthstart_"+uid).datepicker({
    dateFormat:'dd-mm-yy',
    date: $("#midmonthstart_"+uid).val(),
    current: $("#midmonthstart_"+uid).val(),
    starts: 1,
    position: 'r',
    onBeforeShow: function(){
        $("#midmonthstart_"+uid).DatePickerSetDate($("#midmonthstart_"+uid).val(),     true);
    },
    onChange: function(formated, dates){
        $("#midmonthstart_"+uid).val(formated);
        $("#midmonthstart_"+uid).DatePickerHide();
    }
  });
}

See the documentation:

http://api.jqueryui.com/datepicker/#option-dateFormat


Need Your Help

Error in displaying values

java

I'm trying to display a function and it end's up having an error , this is the function

How do I replace this Singleton?

design-patterns dependency-injection singleton

So I was recently added to a new project at work and the Java code has about 10-15 Singleton classes that are used EVERYWHERE. The purpose of these classes is to obtain data from a server (when the