Search code examples
jquerydatedatetimepickerhourminute

jquery datetime pickers for selecting date hours and minutes


i want to have a datetime picker of jquery to select the date, hours, and minutes. i want to have 12 hours clock which shows am-pm. and minutes selection. all plugins showing 24 hours clock and current time. i dont want to select the current time i should be able to select whatever the time i want.all plugins showing minutes step as 10 minutes or 15 minutes etc., i dont want this. i want to have time selection in 12 hrs format with am-pm and minutes selection from 1 to 59 minutes. i am unable to find this plugin. please help me.


Solution

  • Here is a datetime picker based on bootstrap with am-pm option and time selection in 12 hrs format with tt too.

    http://eonasdan.github.io/bootstrap-datetimepicker/

    Minimum setup is the following:

    <div class="container">
        <div class="row">
            <div class='col-sm-6'>
                <div class="form-group">
                    <div class='input-group date' id='datetimepicker1'>
                        <input type='text' class="form-control" />
                        <span class="input-group-addon">
                            <span class="glyphicon glyphicon-calendar"></span>
                        </span>
                    </div>
                </div>
            </div>
            <script type="text/javascript">
                $(function () {
                    $('#datetimepicker1').datetimepicker();
                });
            </script>
        </div>
    </div>
    

    Of course you must include the plugin and dependencies:

    • jQuery
    • Moment.js
    • Bootstrap.js (transition and collapse are required if you're not using the full Bootstrap)
    • Bootstrap Datepicker script
    • Bootstrap CSS Bootstrap
    • Datepicker CSS
    • Locales: Moment's locale files