在jQuery UI Datepicker中使用小时,分钟和秒格式格式化日期 [英] Format date with hours, minutes and seconds in jQuery UI Datepicker

查看:2405
本文介绍了在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 /

这篇关于在jQuery UI Datepicker中使用小时,分钟和秒格式格式化日期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆