DateTimePicker AM/PM Dropdown

44.2k Views Asked by At

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!

2

There are 2 best solutions below

0
On BEST ANSWER

Quick solution:

jquery-ui-timepicker-addon.js

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

0
On

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',
        });