在jQuery UI Datepicker中使用小时,分钟和秒格式格式化日期

在jQuery UI Datepicker中使用小时,分钟和秒格式格式化日期

问题描述:

可以使用 jQuery UI Datepicker 格式显示时间,分钟和秒数吗?

Is possible to format date with jQuery UI Datepicker as to show hours, minutes and seconds?

这是代码:

<script>
    $(function() {
        $('#datepicker').datepicker({ dateFormat: 'yyy-dd-mm HH:MM:ss' }).val();
    });
</script>

但是如果运行DatePicker,它只显示 201313-07-03 HH:July :ss

But if run DatePicker it shows only 201313-07-03 HH:July:ss.

示例如下: http:/ /jsfiddle.net/Qv36W/1/

$("#datepicker").datepicker("option", "dateFormat", "yy-mm-dd ");

对于时间选择器,您应该添加timepicker到Datepicker,它将被格式化与一个等效的命令

For the time picker, you should add timepicker to Datepicker, and it would be formatted with one equivalent command.

编辑

使用这个扩展jQuery UI Datepicker的。您可以选择日期和时间。

Use this one that extend jQuery UI Datepicker. You can pick up both date and time.

http://trentrichardson.com / examples / timepicker /