Html:
<label class="layui-form-label">登录时间:</label>
<input type="date" name="date_min" placeholder="" autocomplete="off" class="layui-input"
value="{$param.date_min|default=''}">
</div>
<input type="date" name="date_max" placeholder="" autocomplete="off" class="layui-input"
value="{$param.date_max|default=''}">
</div>
</div>
Php:
Where:
// 登录时间
if (!empty($param['date_min']) && !empty($param['date_max'])) {
$temp=$param['date_max'];
$maxtime = date('Y-m-d',strtotime("$temp+1day"));
$where['create_time'] = array('between time',[$param['date_min'], $maxtime ]);
}else if(!empty($param['date_min'])){
$where['create_time'] = array('egt',strtotime($param['date_min']));
}else if(!empty($param['date_max'])){
$temp=$param['date_max'];
$maxtime = date('Y-m-d',strtotime("$temp+1day"));
$where['create_time'] = array('elt',strtotime($maxtime));
}
文章来源:刘俊涛的博客 欢迎关注公众号、留言、评论,一起学习。
若有帮助到您,欢迎点击推荐,您的支持是对我坚持最好的肯定(*^_^*)


