开发者

Format date of datetime picker

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜