TimeBucket Process
This example shows the usage of TimeBucket process
orderDate | amount |
2018-10-01 |
100 |
2018-10-12 |
300 |
2018-10-23 |
200 |
2018-10-28 |
100 |
2018-11-03 |
300 |
2018-11-14 |
300 |
2018-11-16 |
400 |
2018-11-25 |
500 |
2018-12-03 |
200 |
2018-12-14 |
100 |
2018-12-17 |
200 |
2018-12-23 |
400 |
->pipe(new TimeBucket(array(
"orderDate"=>"month"
)))
orderDate | amount |
2018-10 |
100 |
2018-10 |
300 |
2018-10 |
200 |
2018-10 |
100 |
2018-11 |
300 |
2018-11 |
300 |
2018-11 |
400 |
2018-11 |
500 |
2018-12 |
200 |
2018-12 |
100 |
2018-12 |
200 |
2018-12 |
400 |
->pipe(new Group(array(
"by"=>"orderDate",
"sum"=>"amount"
)))
orderDate | amount |
2018-10 |
700 |
2018-11 |
1,500 |
2018-12 |
900 |
The example demonstrates usage of `TimeBucket` process. The TimeBucket work on the `datetime` `date` and `time` column to put those date time into a separate bucket for example week, month or year. This process normally is used with `Group` process to provide grouping.
```
->pipe(new TimeBucket(array(
"orderDate"=>"month"
)))
->pipe(new Group(array(
"by"=>"orderDate",
"sum"=>"amount"
)))
```