I call webservice and get the data. The data is in the format -
mail: " xyz@xyz.com " price: "9.5" name: "xyz" receiveddate: "1374484561920"
I convert the date in milliseconds to the date and find the hour in which the price was something. Thus, each EnterDate has an hour ie 11, 12, 13, etc.
for(var l=0; l<data.length; l++){ var dataDate = recs[l].receiveddate; dataDate = +dataDate; var eachEntryDate = new Date(+dataDate.toString()); eachEntryDate = eachEntryDate.toString(); eachEntryDate = parseInt(eachEntryDate.substr(16, 2)); hourlyRecs[l] = {hour:eachEntryDate, price:recs[l].price}; }
Now I want to get the average price for each hour. that is, the average price, where the hour is 11.12, etc. The data is in random order. What is the best way to do this?
source share