Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

DateTimePicker AM/PM Dropdown

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!

like image 634
streetlight Avatar asked Oct 19 '12 12:10

streetlight


2 Answers

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',
        });
like image 178
Cray Kao Avatar answered Oct 12 '22 13:10

Cray Kao


Quick solution:

jquery-ui-timepicker-addon.js

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

like image 39
Peter Kigonya Avatar answered Oct 12 '22 11:10

Peter Kigonya