开发者

Format date of datetime picker

开发者 https://www.devze.com 2023-03-06 14:39 出处:网络
How do I format the date of this? I can format the time easily but not the date. http://trentrichardson.com/examples/tim开发者_如何学JAVAepicker/

How do I format the date of this? I can format the time easily but not the date.

http://trentrichardson.com/examples/tim开发者_如何学JAVAepicker/

It uses the normal datetime from jquery UI.

$('.date').datetimepicker({
    timeFormat: 'hh:mm', 
});

This one will not work:

$('.date').datetimepicker({
    timeFormat: 'hh:mm', 
    dateFormat: 'yy-mm-dd' //This does nothing and does not format the data 
});

How do I format the date from this new plugin?


Try setting the Date Picker default format.

$.datepicker.setDefaults({dateFormat: 'yy-mm-dd' });

This should work since timepicker seems to be wrapping datepicker.


try using this:

$('.date').timepicker({
    timeFormat: 'hh:mm', 
});

$('.date').datepicker({
    dateFormat: 'yy-mm-dd' //The day format is tied to the datepicker script rather than to the timepicker script
});


Shouldn't you be setting those at the same time?

$('.date').timepicker({    
  timeFormat: 'hh:mm', 
  dateFormat: 'yy-mm-dd' 
});


you should use

    $('.date').datetimepicker({    
      timeFormat: 'hh:mm', 
      dateFormat: 'yy-mm-dd' 
    });
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号