按周统计
BusinessDataModel::where('type_id',1)->field("from_unixtime(create_time,'%a') as time,count(id) as count")->group('time')->select()->toArray()
按天
field("from_unixtime(create_time,'%Y-%m-%d') as time,count(id) as count")
from_unixtime()函数
日期格式 说明
%Y 年,4位数字,如1999
%y 年,2位数字,如00
%M 月,英文月份,如January
%b 月,缩写的月份名字,如Jan
%m 月,数字(01……12)
%c 月,数字(1……12)
%W 星期,名字,如Sunday
%a 星期,缩写的名字,如Sun
%D 天,有英文前缀的天日期,如1st
%d 天,月份中的天数,数字(01……31)
%e 天,月份中的天数,数字(1……31)
%H 小时,数字(00……23)
%k 小时,数字(0……23)
%h 小时,数字(01……12)
%l 小时,数字(1……12)
%r 时间,12 小时(hh:mm:ss [AP]M)
%T 时间,24 小时(hh:mm:ss)
%S 秒(00~59)
%s 秒(00~59)