这是我的jsfiddle:http://jsfiddle.net/vivpad/7s0a7m3p/7/
我正在使用http://eonasdan.github.io/bootstrap-datetimepicker/和moment.js
<div class="row">
<div class="col-md-12">
<h6>datetimepicker1</h6>
<div class="form-group">
<div class="input-group date" id="datetimepicker1">
<input type="text" class="form-control" /> <span class="input-group-addon"><span class="glyphicon-calendar glyphicon"></span></span>
</div>
</div>
<h6>datetimepicker2</h6>
<input type="text" class="form-control" id="datetimepicker2" />
</div>
</div>
我的JQuery代码如下
$('#datetimepicker1').datetimepicker({
format: 'DD/MM/YYYY'
});
$('#datetimepicker2').datetimepicker({
format: 'LT'
});
我需要关注:
答案 0 :(得分:3)
试试这个
<br/>
<div class="row">
<div class="col-md-12">
<h6>Datetimepicker</h6>
<div class="form-group">
<div class="input-group date" id="datetimepicker">
<input type="text" class="form-control" /> <span class="input-group-addon"><span class="glyphicon-calendar glyphicon"></span></span>
</div>
</div>
</div>
<强> JS 强>
$(function () {
$('#datetimepicker').datetimepicker({
format : 'DD/MM/YYYY HH:mm',
minDate: moment().add(1, 'h'),enabledHours: [10, 11, 12, 13, 14, 15, 16,17]
});
});
答案 1 :(得分:2)
你可以使用这样的东西 -
$('#datetimepicker').datetimepicker({
'format': 'd/m/Y H:i',
'minDate': -0,
'closeOnDateSelect' : true,
'validateOnBlur' : true,
'minDateTime': new Date()
});