当月第一天、最后一天、下月第一天,时间date

时间记录,不是时间戳

1  $thismonth = date('m');
2  $thisyear = date('Y');
3  $startDay = $thisyear . '-' . $thismonth . '-1';
4  $endDay = $thisyear . '-' . $thismonth . '-' . date('t', strtotime($startDay));     //当月最后一天
5  $time1 =date('Y-m-1 H:i:s',strtotime($startDay));   //当月第一天
6  $time2 = date('Y-m-d H:i:s',strtotime('+24 hour',strtotime($endDay)));  //下个月月第一天
7  $monthScore =PointLog::where([['create_time','>=',$time1],['create_time','<=',$time2]])->where('userid','=',$_COOKIE['userid'])->sum('point');

 

posted @ 2017-06-30 15:49  万里冰封  阅读(510)  评论(0编辑  收藏  举报