How to activate 24 hours in Datapicker Bootstrap?

Asked

Viewed 1,027 times

2

DataPicker- Bootstrap

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

2 answers

3

Placing the references of:

Css

Javascript

format the time format with H in capital, 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>
<script src="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>
<script src="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:

2


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

Use Uppercase HH

Reference: response from the @Benjam

  • Worked... !!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.