DateTimePicker AM/PM Dropdown

streetlight picture streetlight · Oct 19, 2012 · Viewed 40k times · Source

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!

Answer

Cray Kao picture Cray Kao · Dec 27, 2013

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