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
<input type="text" name="time" data-provide="timepicker" id="time" class="form-control" placeholder="Start Time" value="" />
$('#time').timepicker({
timeFormat: 'H:i',
'scrollDefaultNow' : 'true',
'closeOnWindowScroll' : 'true',
'showDuration' : false,
'ignoreReadonly' : true,
})
work for me.
"YYYY-MM-DD HH:mm:ss" => 24 hours format;
"YYYY-MM-DD hh:mm:ss" => 12 hours format;
the difference is letter 'H'
And this works for me:
$(function () {
$('#datetimepicker5').datetimepicker({
format: 'HH:mm'
});
});
The below code is correct answer for me.
$('#datetimepicker6').datetimepicker({
format : 'YYYY-MM-DD HH:mm'
});
To pick only time with 24 hr time format, use
$('#datetimepicker').datetimepicker({
format: 'HH:mm'
});
If you want to pick 24 hr time format with date also, use
$('#datetimepicker').datetimepicker({
format: 'MM/DD/YYYY HH:mm'
});
Example :
$(function() {
$('#datetimepicker1').datetimepicker({
format: 'HH:mm'
});
$('#datetimepicker2').datetimepicker({
format: 'MM/DD/YYYY HH:mm'
});
$('#datetimepicker3').datetimepicker({
format: 'hh:mm A',
});
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.15.1/moment.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/bootstrap-datetimepicker/4.7.14/js/bootstrap-datetimepicker.min.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datetimepicker/4.7.14/css/bootstrap-datetimepicker.min.css">
<div class="container">
<div class="row">
<div class='col-sm-6'>
<div class="form-group">
<span>Select 24 hour time format</span>
<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>
<br/>
<span>Select time with Date</span>
<div class='input-group date' id='datetimepicker2'>
<input type='text' class="form-control" />
<span class="input-group-addon">
<span class="glyphicon glyphicon-calendar"></span>
</span>
</div>
<br/>
<span>Select 12 hour time format</span>
<div class='input-group date' id='datetimepicker3'>
<input type='text' class="form-control" />
<span class="input-group-addon">
<span class="glyphicon glyphicon-calendar"></span>
</span>
</div>
</div>
</div>
</div>
</div>
For more info
This will surely help on bootstrap timepicker
format :"DD:MM:YYYY HH:mm"