jQuery UI DatePicker - Change Date Format

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

    I think the correct way to do this would be something like this:

    var picker = $('.date-picker');
    var date = $.datepicker.formatDate(
        picker.datepicker('option', 'dateFormat'),
        picker.datepicker('getDate'));
    

    This way you make sure the format string is defined only once and you use the same formatter to translate the format string into the formatted date.

提交回复
热议问题