Reputation: 36058
I have a lot of data retrived from server with the following format:
{id:1,name:"xx",type:1,updated:'2014-01-01 12:21'},
{id:1,name:"xx",type:2,updated:'2014-01-01 12:21'},
{id:1,name:"xx",type:3,updated:'2014-01-01 12:21'},
.................................
Now I have to make some statistics:
1 By month
Calculate months belongs to this year and the range(start
and end
) of each month.
Calculate how many items for different type for each month in the current year.
2 By week
Calculate days belongs to this week and the range(start
and end
) of each day.
Calculate how many items for different type for every day in the current week.
3 By hour
Calculate hours(24) belongs to today and the range(start
and end
) of each hour.
Calculate how many items for different type for each hour;
I wonder if there is any date-time library to make the calculate work easier?
Upvotes: 0
Views: 94