DateTimePicker AM/PM Dropdown

匿名 (未验证) 提交于 2019-12-03 01:48:02

问题:

I'm using (and loving) datetimepicker, the great add on to the jQuery UI Datepicker. However, I'm using the dropdown option (you can see all of them here -- http://trentrichardson.com/examples/timepicker/), and I want to have three dropdowns -- one for hours (1-12), minutes (00 to 60), and AM/PM.

Right now, the hours field also has the am/pm, and I'm not sure how to add another dropdown to control the AM/PM.

Here's my initialization:

$( ".datepicker" ).datetimepicker({                         controlType: 'select',                         timeFormat: "h:mm TT",                         ampm: true                 });

I feel like this may be a very easy problem, but I can't find any real documentation that alludes to how I do this. Please help!

回答1:

Quick solution:

jquery-ui-timepicker-addon.js

override or change "controlType: 'slider'," to "controlType: 'select',"



回答2:

Check this one and it works quiet well for me.

http://xdsoft.net/jqplugins/datetimepicker/

The workable script:

        $j('dDatetime').datetimepicker({             format: 'Y/m/d A g:i',             formatTime: 'A g:i',         });


转载请标明出处:DateTimePicker AM/PM Dropdown
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!