废话不多说,上代码
js(columns)中
{field: 'start_time', title: '开始时间', formatter: Table.api.formatter.datetime, addclass: 'datetimepicker', style: 'min-width:90px;'},
{field: 'end_time', title: '结束时间', formatter: Table.api.formatter.datetime, addclass: 'datetimepicker', style: 'min-width:90px;'},
view
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">开始时间:</label>
<div class="col-xs-12 col-sm-8">
<input class="form-control datetimepicker"
data-date-format="YYYY-MM-DD HH:mm:ss"
data-use-current="true"
type="text"
data-rule="required"
name="start_time"
placeholder="请选择时间">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">结束时间:</label>
<div class="col-xs-12 col-sm-8">
<input class="form-control datetimepicker"
data-date-format="YYYY-MM-DD HH:mm:ss"
data-use-current="true"
type="text"
data-rule="required"
name="end_time"
placeholder="请选择时间">
</div>
</div>
data-date-format设置时间选择器格式,如果只需要年月日的,去掉后面的HH:mm:ss