TP5.1 时间查询

时间查询,和一般的字段查询要分成两段,5和5以前的写法都用不了了
例子

$where_time = [
            ['f_datetime', 'between time', [$start_date, $end_date]],
        ];
$where = [
            'member_id'=>$this->user_id,
        ];
$field = [
            'count(id)' => 'count',
            'DATE_FORMAT(f_datetime, "%c月%e日" )' => 'date',
        ];
$res = PlanModel::where($where_time)->where($where)->group('DATE_FORMAT(f_datetime, "%c-%e" )')->field($field)->select()->toArray();


猜你喜欢

转载自blog.csdn.net/u012993454/article/details/80883725