//获取本月开始和结束时间
$m = date('Y-m-d', mktime(0, 0, 0, date('m'), 1, date('Y'))); //本月的开始日期
$t = date('t', strtotime($m)); //本月共多少天
$start = date('Y-m-d', mktime(0, 0, 0, date('m'), 1, date('Y'))); //本月的开始日期
$end = date('Y-m-d', mktime(23, 59, 59, date('m'), $t, date('Y'))); //本月的结束日期
$time = strtotime($start);
$sta = strtotime(date('Y-m-d H:i:s', $time));
$jieshu = strtotime($end);
$en = strtotime(date('Y-m-d 23:59:59', $jieshu));
$where = '1=1';
$start_time = $_GET['start_uploadtime'];
$end_time = $_GET['end_uploadtime'];
if ($start_time) {
$where_start_time = strtotime($start_time);
}
if ($end_time) {
$where_end_time = strtotime($end_time) + 60 * 60 * 24;
}
if ($where_start_time && $where_end_time) {
$where .= " AND `addtime` between $where_start_time and $where_end_time";
} else {
$where .= " AND `addtime` between $sta and $en";
}
return $where;