我无法看到如何从日期和时间范围选择器中获取开始和结束我通常使用data-link-field="dtp_input1"
来将数据插入到表中,就像我这样编码:
<input type="hidden" id="dtp_input1" name="date" value="" /><br/>
现在我的日期和时间范围选择器的代码是这样的:
<div class="form-group">
<label>Date and time range:</label>
<div class="input-group">
<div class="input-group-addon"> <i class="fa fa-clock-o"></i>
</div>
<input type="text" class="form-control pull-right" id="reservationtime">
</div>
<!-- /.input group -->
</div>
<!-- /.form group -->
和javascript:
$('#reservationtime').daterangepicker({
timePicker: true,
timePickerIncrement: 30,
format: 'MM/DD/YYYY h:mm A'
});
如何编写代码来开始和结束并在mysql数据库中输入
答案 0 :(得分:0)
$('#reservationtime').daterangepicker({
timePicker: true, timePickerIncrement: 30,
format: 'MM/DD/YYYY h:mm A'
}).bind('datepicker-change',function(event, obj)
/* This event will be triggered when second date is selected */
console.log('change',obj);
// obj will be something like this:
// {
// date1: (Date object of the earlier date),
// date2: (Date object of the later date),
// value: "2013-06-05 to 2013-06-07"
// }
})