jQuery UI DatePicker - Change Date Format

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

    The getDate method of datepicker returns a date type, not a string.

    You need to format the returned value to a string using your date format. Use datepicker's formatDate function:

    var dateTypeVar = $('#datepicker').datepicker('getDate');
    $.datepicker.formatDate('dd-mm-yy', dateTypeVar);
    

    The full list of format specifiers is available here.

提交回复
热议问题