format date in jQuery UI datepicker

后端 未结 2 1485
余生分开走
余生分开走 2020-12-11 23:50

I use the datepicker from jQuery UI, but the format is like example today: 08/01/2013

But i want the format to be example today: 2013-08-01

Her

相关标签:
2条回答
  • 2020-12-12 00:42

    You can directly set the date format from jquery-ui library,that's work for me.hope for you also

    in

    function Datepicker()
    {
      //other code
      dateFormat: "yy-mm-dd", // See format options on parseDate 
      //other code
    }
    
    0 讨论(0)
  • 2020-12-12 00:48

    since your already have other options in the datepicker... add it there.

    try this

    $("#txtFromDate").datepicker({
        minDate: "07/17/2012",
        maxDate: "0D",
        numberOfMonths: 2,
        dateFormat: "yy-mm-dd", //<----here
        onSelect: function(selected) {
          $("#txtToDate").datepicker("option","minDate", selected);
        }
    });
    
    0 讨论(0)
提交回复
热议问题