jQuery UI DatePicker - Change Date Format

前端 未结 28 1833
后悔当初
后悔当初 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:06

    getDate function returns a JavaScript date. Use the following code to format this date:

    var dateObject = $("#datepicker").datepicker("getDate");
    var dateString = $.datepicker.formatDate("dd-mm-yy", dateObject);
    

    It uses a utility function which is built into datepicker:

    $.datepicker.formatDate( format, date, settings ) - Format a date into a string value with a specified format.

    The full list of format specifiers is available here.

提交回复
热议问题