html头部引入相关的js和css
<link rel="stylesheet" type="text/css" href="css/bootstrap-datetimepicker.css"/> <script src="js/bootstrap-datetimepicker.js"></script> <script src="js/locales/bootstrap-datetimepicker.zh-CN.js"></script>
时间调用及bootstrap图标,bootstrap版本:V3
<div class="input-group date form_datetime"> <input style="background-color:#FFFFFF" name="starttime" type="text" class="form-control" placeholder="点击获取开始日期" readonly="readonly"> <span class="input-group-addon"><span class="glyphicon glyphicon-th"></span></span> </div> <div class="input-group date form_datetime"> <input style="background-color:#FFFFFF" name="endtime" type="text" class="form-control" placeholder="点击获取结束日期" readonly="readonly"> <span class="input-group-addon"><span class="glyphicon glyphicon-th"></span></span> </div>
控制日期js:
/*日期调用*/ $(".form_datetime").datetimepicker({ format: "yyyy-mm-dd", //pickTime: false, autoclose: true, todayBtn: true, minView: "month", maxView: "decade", language: "zh-CN", pickerPosition: "bottom-left" })