Using 24 hour time in bootstrap timepicker

前端 未结 15 876
太阳男子
太阳男子 2020-12-03 13:55

Hi im using http://eonasdan.github.io/bootstrap-datetimepicker/ on bootstrap, specifically example number 4.

I added this property to take away the PM thing and be a

相关标签:
15条回答
  • 2020-12-03 14:10

    Use capitals letter for hours HH = 24 hour format an hh = 12 hour format

    $('#fecha').datetimepicker({
       format : 'DD/MM/YYYY HH:mm'
    });

    0 讨论(0)
  • 2020-12-03 14:11

    It looks like you have to set the option for the format with data-date-*. This example works for me with 24h support.

    <div class="form-group">
        <div class="input-group date timepicker"
            data-date-format="HH:mm"
            data-date-useseconds="false"
            data-date-pickDate="false">
    
            <input type="text" name="" />
            <div class="input-group-addon">
                <i class="fa fa-clock-o"></i>
            </div>
        </div>
    </div>
    
    0 讨论(0)
  • 2020-12-03 14:13
    $('.time-picker').timepicker({
                showMeridian: false     
            });
    

    This will work.

    0 讨论(0)
  • 2020-12-03 14:13

    It looks like you have to set the option for the format with data-date-*. This example works for me with 24h support.

    0 讨论(0)
  • 2020-12-03 14:15

    EDIT: There are much better answers on this thread than this one. I was just getting the hang of JavaScript at the time I answered. Specifically, see these two.

    If you search within the development version of that script, there's a function called use24hours that looks for a value of either true or false.

    Adding use24hours:true might do the job for you. Like so:

    $(function () {
        $('#datetimepicker5').datetimepicker({
            use24hours: true
        });
    });
    
    0 讨论(0)
  • 2020-12-03 14:16
    <script>    
        $(function () {
    
            /* setting time */
            $("#timepicker").datetimepicker({
                format : "HH:mm:ss"
            });
    
        }    
    </script>
    

    Example bootstrap datetimepicker eonasdan

    0 讨论(0)
提交回复
热议问题