【发布时间】:2017-10-26 07:30:38
【问题描述】:
我想按DATETIME created字段统计和检索不同时期的数据,例如今天、总计、本周等。
例如 this_week 如何计算?
这里是起始代码:
public function findTotalRegistered(Query $query, Array $options)
{
$total = $query->func()->count('id');
$query
->select([
'total' => $total,
//'today' => $today,
//'this_week' => $this_week,
//'this_month' => $this_month,
//'this_year' => $this_year
]);
return $query;
}
【问题讨论】:
标签: mysql cakephp orm cakephp-3.0