时间段查询 – 青春部落,流年似水 http://www.youthtribe.com 青春是一场远行,总记不起来时的路。 Thu, 28 Dec 2017 09:11:17 +0000 zh-CN hourly 1 https://wordpress.org/?v=6.1.7 时间段查询 – 青春部落,流年似水 http://www.youthtribe.com/archives/1727 http://www.youthtribe.com/archives/1727#respond Thu, 28 Dec 2017 09:11:17 +0000 http://www.youthtribe.com/?p=1727 public function payRollList($time) { $member_phone = Session::get(phone'); $engineer = Engineer::getEngineerByPhone($member_phone); $start=date('Y-m-01',strtotime($time));//获取指定月份的第一天 $end=date('Y-m-t',strtotime($time)); //获取指定月份的最后一天 $repair=DB::table('order') ->where('repair_user',$engineer['member_id']) ->where('order_status',1) ->whereBetween('create_time',[strtotime($start),strtotime($end)]) ->where('status',0) ->orderBy('create_time', 'desc') ->paginate($this->number); return view('home.engineer.payroll_order')->with('phone', $member_phone)->with('repair', $repair); }

主要是whereBetween这句。create_time 为mysql的timestamp类型

whereBetween('create_time',[strtotime($start),strtotime($end)])

原文地址:https://www.cnblogs.com/lamp01/p/6914089.html

 

]]>
http://www.youthtribe.com/archives/1727/feed 0