我在我的项目中使用 timepicker,但我需要在 24 小时内没有 am,pm 这是我的代码
<div class="bootstrap-timepicker" >
<label for="email" class="col-sm-2 control-label">From Time</label>
<input type="text" id="from_time" class="form-control timepicker" style="width: 30%;" >
<label for="email" class="col-sm-2 control-label">To Time</label>
<input type="text" id="to_time" class="form-control timepicker" style="width: 30%;" >
<!-- /.input group -->
</div>Run Code Online (Sandbox Code Playgroud)
但是这段代码给了我这样的 12 小时格式
04:00 PM
Run Code Online (Sandbox Code Playgroud)
但我想要的
16:00
Run Code Online (Sandbox Code Playgroud)
如果您使用的是 jquery timepicker
$('input.timepicker').timepicker({
timeFormat: 'HH:mm:ss',
});
如果您使用的是引导程序时间选择器
$(function () {
$('#datetimepicker4').datetimepicker({
pickDate: false,
minuteStepping:30,
format: 'hh:mm',
pickTime: true,
defaultDate: new Date(1979, 0, 1, 8, 0, 0, 0),
language:'en',
use24hours: true
});
});
Run Code Online (Sandbox Code Playgroud)