是否可以在日期时间选择器中更改日期格式?
问题描述:
我发现了一个基于jQuery-ui的很棒的日期时间选择器 http://trentrichardson.com/examples/timepicker /,但突然意识到我无法修改日期格式...尝试过这样的事情:
I found a great date time picker based on jQuery-ui http://trentrichardson.com/examples/timepicker/, but suddenly realized that i can't modify date format... Tried something like this:
jQuery('.datetimepicker').datetimepicker({
timeFormat: 'HH:mm'
}).formatDate('yy-mm-dd');
有人可以在上面显示一个例子吗?
Can someone show an example on it?
答
您可以使用以下代码:
jQuery('.datetimepicker')
.datetimepicker({
dateFormat: 'yy-mm-dd',
timeFormat: 'HH:mm'
});