第一步 html
<div class="form-group col-lg-3">
<div class="input-group form_datetime">
<span class="input-group-addon">收集时间:</span>
<input class="form-control datetimepicker"
data-date-format="YYYY-MM-DD"
type="text"
data-rule="required"
name="collecttime"
placeholder="请选择时间">
</div>
</div>
如果以上步骤完成后试试如果可以调起来则完成,不可以的话在对应页面的js中添加如下js(直接复制粘贴)
/************************日期时间选择的插件**********************/
//绑定select元素事件
require(['bootstrap-datetimepicker'], function () {
var options = {
format: 'YYYY-MM-DD HH:mm:ss',
icons: {
time: 'fa fa-clock-o',
date: 'fa fa-calendar',
up: 'fa fa-chevron-up',
down: 'fa fa-chevron-down',
previous: 'fa fa-chevron-left',
next: 'fa fa-chevron-right',
today: 'fa fa-history',
clear: 'fa fa-trash',
close: 'fa fa-remove'
},
showTodayButton: true,
showClose: true
};
$('.datetimepicker').parent().css('position', 'relative');
$('.datetimepicker').datetimepicker(options);
});
/************************日期时间选择的插件END**********************/