Search code examples
jquerytwitter-bootstrap-3timepicker

jQuery: Bootstrap timepicker with hh:mm:ss format


I'm looking for a bootstrap timepicker that has a hh:mm:ss format. I've search the web but all I can find is a bootstrap timepicker with hh:mm format.


Solution

  • You should use http://eonasdan.github.io/bootstrap-datetimepicker/ datetimePicker, by setting the format of the dateTimePicker to 'hh:mm:ss'

    You have to use - moment.js - For more formats, you should check: http://momentjs.com/docs/#/displaying/format/

    I have created a JSFiddle.

    http://jsfiddle.net/jagtx65n/

    HTML:

    <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>
    

    JS:

    $(function () {
       $('#datetimepicker1').datetimepicker({
          format: 'hh:mm:ss'
       });
    });
    

    EDIT

    open when click the input field:

    $(function(){
    $('#datetimepicker1').datetimepicker({
        format: 'hh:mm:ss',
        allowInputToggle: true
    });
    
    });