How to activate 24-hour Datapicker Bootstrap?

2

<scripttype="text/javascript">
    $(function () {
        $('#datetimepicker1').datetimepicker({
             format: 'YYYY-MM-DD hh:mm:ss',
             locale: 'fr,
             use24hours: true       
        });
    });
</script>
    
asked by anonymous 17.11.2016 / 16:46

2 answers

2
<script type="text/javascript">
    $(function () {
        $('#datetimepicker1').datetimepicker({
             format: 'YYYY-MM-DD HH:mm:ss',
            locale: 'fr,
             use24hours: true       
        });
    });
</script>

Use upper HH

Reference: response from @ Benjam

    
17.11.2016 / 16:50
3

Placing the references of:

Css

Javascript

format the time format with H in uppercase , example:

format: 'YYYY-MM-DD HH:mm:ss'

$('#datetimepicker1').datetimepicker({           
       format: 'YYYY-MM-DD HH:mm:ss',
       locale: 'PT-BR'             
});
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<link href="https://cdn.rawgit.com/Eonasdan/bootstrap-datetimepicker/a549aa8780dbda16f6cff545aeabc3d71073911e/build/css/bootstrap-datetimepicker.css" rel="stylesheet"/>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.2.4/jquery.min.js"></script><scriptsrc="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/js/bootstrap.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.9.0/moment-with-locales.js"></script><scriptsrc="https://cdn.rawgit.com/Eonasdan/bootstrap-datetimepicker/a549aa8780dbda16f6cff545aeabc3d71073911e/src/js/bootstrap-datetimepicker.js"></script>

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

References:

17.11.2016 / 17:09