This is a question, which I could not find answer to anywhere. Okay. here it is. I have two date ranges (This month and the last month)
Last month - 01/01/2015 (January 1 2015) to 31/01/2015 This month - 01/02/2015 (1st Feb 2015) to 28/02/2015
Now, each month has weeks. I have a table with column created_at. I want to fetch all the records week-wise into an array (to plot a graph) with their corresponding sum(value) or count(value) .
So it will be something like this: Last Month: Week 1 - 25 Week 2 - 34 etc.
This Month: Week 1: 55 Week 2: 56 etc.
The date is in this format in created_at: 2015-07-21 01:27:14 (Y-m-d H:i:s)