PHP统计常用时间

  //订单统计:今日新增
$today_begin = strtotime(date('Y-m-d'));
$today_end     = strtotime(date('Y-m-d').' 23:59:59');
$today = $m->where('faddtime >= '.$today_begin.' and faddtime <= '.$today_end)->count();

//订单统计:昨日新增
$yestoday_begin = strtotime('-1 day', $today_begin);
$yestoday_end    = strtotime('-1 day', $today_end);
$yestoday = $m->where('faddtime >= '.$yestoday_begin.' and faddtime <= '.$yestoday_end)->count();

//订单统计:本月新增
$month_begin = strtotime(date('Y-m-d', strtotime('first day of this month')));
$month_end    = strtotime(date('Y-m-d', strtotime('last day of this month')) . ' 23:59:59');


//店铺概况:本周新增
$week_begin = strtotime(date("Y-m-d",strtotime('last Monday')));
$week_end    = strtotime(date("Y-m-d",strtotime('this Sunday')).' 23:59:59');

 

//年度
$year              = date('Y');
$year_begin = strtotime($year.'-01-01');
$year_end    = strtotime($year.'-12-31' . ' 23:59:59');
 

300*300
 文章首页关于迷茫时代关于我写意人生
版权所有:迷茫时代 All rights reserved   
执行时间:0.00757 秒