JQuery UI Datepicker date format issue with initial value

后端 未结 5 2215
梦毁少年i
梦毁少年i 2020-12-06 01:29

I need to set the initial date for the date picker to 03/20/2010 in mm-dd-yyyyy format. I have done this



        
5条回答
  •  误落风尘
    2020-12-06 02:17

    Not accurate!!!

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

    You must to put the right format in dateFormat : for your example there is : dd/mm/yy two mistake:

    • day/month inversion
    • year is only two 'y' not four

提交回复
热议问题