Search code examples
datetimepickertimepickerbootstrap-datetimepicker

Bootstrap datetimepicker :: how can i set it in 'hh:mm:ss' format?


How can I set a particular format in bootstrap 3 Datetimepicker?. The format should be "hh:mm:ss" and I don't want "AM" and "PM". Actually, this is for selecting Hours, minutes and seconds. I tried with this code,but it is not working.

   <div class="container">
     <div class="row">
       <div class='col-sm-6'>
        <input type='text' class="form-control" id='datetimepicker4' />
       </div>

       <script type="text/javascript">
        $(function () {
            $('#datetimepicker4').datetimepicker();
              pickDate: false
        });
       </script>
     </div>
   </div>

I want to get it to appear like this -

demo date picker


Solution

  • You can use format option to set the date format you prefer. In your case you can have:

    $('#datetimepicker4').datetimepicker({
        format: 'HH:mm:ss'
    });