I have a bunch of objects, each of which has a timestamp, that I want to group by date, into a JSON object. The ultimate goal is something like this:
myObject = {
"06/07/2012" : [
{
"timestamp" : "07/06/2012 13:30",
...
},
{
"timestamp" : "07/06/2012 14:00",
...
}
],
"07/07/2012 [...]
}
To get the date, I'm testing each timestamp object and using:
var visitDate = new Date(parseInt(item.timestamp, 10));
visitDate.setHours(0);
visitDate.setMinutes(0);
visitDate.setSeconds(0);
..then I'm using that to store as a name for the JSON object. It seems messy, and I'm sure there should be an easier way of doing things.
Advice / suggestions welcomed!!