$('.date_start').datetimepicker({
language: 'zh-CN',
weekStart: 1,
todayBtn: 1,
autoclose: 1,
showMeridian: true,
todayHighlight: 1,
startView: 2,
minView: 2,
forceParse: 0,
endDate: new Date()
}).on('hide', function(event) {
event.preventDefault();
event.stopPropagation();
$('.date_end').datetimepicker('setStartDate',$('.date_start').data("datetimepicker").getDate());
//$('.date_end').val("");
});
$('.date_end').datetimepicker({
language: 'zh-CN',
weekStart: 1,
todayBtn: 1,
autoclose: 1,
showMeridian: true,
todayHighlight: 1,
startView: 2,
minView: 2,
forceParse: 0,
endDate: new Date()
}).on('hide', function(event) {
event.preventDefault();
event.stopPropagation();
$('.date_start').datetimepicker('setEndDate',$('.date_end').data("datetimepicker").getDate());
});
補(bǔ)充內(nèi)容:[bootstrap-datetimepicker 如何獲取值(日期)
- 方法一:
$("#startTime").data("datetimepicker").getDate()
- 方法二:
$("#startTime").find("input").val();
- js下格式化:
var date = $("#startTime").data("datetimepicker").getDate(), formatted = date.getFullYear() + "-" + (date.getMonth() + 1) + "-" + date.getDate() + " " + date.getHours + ":" + date.getMinutes() + ":" + date.getSeconds(); alert(formatted);
- data-format格式化:
<input data-format="yyyy-MM-dd hh:mm:ss" type="text"></input>
最后編輯于 :
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者