区间内输出每天的日期
日期区间例如:date=2021-06-29 00:00:00,2021-07-01 23:59:59
list($start, $end) = explode(',', input('date'));
$begintime = strtotime($start);
$endtime = strtotime($end);
for ($start = $begintime; $start <= $endtime; $start += 24 * 3600) {
$dates = date("Y-m-d", $start);
//查询当天的数据,时间格式为datetime
$list = Db::name('表名')
->where(查询条件)
->whereBetweenTime('dial_time',$dates)
->field('*')
->select();
}
区间内输出每月
日期区间例如:date=2021-06-29 00:00:00,2021-07-01 23:59:59
list($start, $end) = explode(',', input('date'));
$begintime = strtotime($start);
$endtime = strtotime($end);
$num = (date('Y',$endtime)-date('Y',$begintime)-1)*12+(12-date('m',$beg