jQuery UI DatePicker - Change Date Format

前端 未结 28 1808
后悔当初
后悔当初 2020-11-21 16:39

I am using the UI DatePicker from jQuery UI as the stand alone picker. I have this code:

And the

28条回答
  •  渐次进展
    2020-11-21 17:24

    $("#datepicker").datepicker("getDate") returns a date object, not a string.

    var dateObject = $("#datepicker").datepicker("getDate"); // get the date object
    var dateString = dateObject.getFullYear() + '-' + (dateObject.getMonth() + 1) + '-' + dateObject.getDate();// Y-n-j in php date() format
    

提交回复
热议问题