var json=[
{"date":"2012/11/01","name":1},
{"date":"2012/11/01","name":2},
{"date":"2012/11/01","name":3},
{"date":"2012/11/02","name":4},
{"date":"2012/11/02","name":5},
{"date":"2012/11/03","name":6},
];
var json2=[
{"date":"2012/11/01 08:00","name":1},
{"date":"2012/11/01 08:00","name":2},
{"date":"2012/11/01 08:00","name":3},
{"date":"2012/11/02 08:00","name":4},
{"date":"2012/11/02 08:00","name":5},
{"date":"2012/11/03 08:00","name":6},
];
var dateArr=[];
var allArr={};
for(var i=0;i<json.length;i++){
if(dateArr.indexOf(json[i]["date"])==-1){
dateArr.push(json[i]["date"]);
}
}
for(k=0;k<dateArr.length;k++){
var ss=[];
for(var i=0;i<json.length;i++){
if(dateArr[k]==json[i]["date"]){
ss.push(json[i]);
}
}
allArr[dateArr[k]]=ss;
}
console.log(dateArr);
console.log(allArr);
截取日期
dateArr[k].substring(0, 10)
dateArr[k].split(" ")[0]