Bitter icon indicating copy to clipboard operation
Bitter copied to clipboard

Add a class to get count for an Event by month or week or day

Open jeremyFreeAgent opened this issue 12 years ago • 1 comments

Something like:

$lastYear = new Year(new DateTime('last year'));
$stats = $bitter->getStats('action', $lastYear, 'month');
$max = $stats->getMax();
foreach ($stats as $stat) {
    echo $stat->getDate() . ' - ' . $stat->getCount() . "\n";
}

jeremyFreeAgent avatar Jan 08 '13 08:01 jeremyFreeAgent

$lastyear = new \DatePeriod(new \DateTime('......'), new \DateTime('P1M'), new \DateTime('......'));

$bitter->getStats('action', $datePeriod);

We have to override DatePeriod to get end date and to add some options.

stephpy avatar Jan 08 '13 09:01 stephpy