js数组按日期分类。
数组如下
var arr=[ { "name": "张奇", "Time": "2017-01-03 19:36:33", "charge": "800", "totaltime": "7599000", "reachTime": "2017-01-04" }, { "name": "张奇", "Time": "2017-01-03 17:22:22", "charge": "100", "totaltime": "922635", "reachTime": "2017-01-03" }, { "name": "张奇", "Time": "2017-01-02 19:36:33", "charge": "200", "totaltime": "", "reachTime": "2017-01-02" }, { "name": "张奇", "Time": "2017-01-01 16:20:07", "charge": "100", "totaltime": "1457076", "reachTime": "2017-01-01" } ]
期望得到
var tests=[ {time: "2017-01-03",money:'900', file:[ {Time: "2017-01-03", charge: "800", name: "张奇", reachTime: "2017-01-04 09:30:00", totaltime: "7599000"}, {Time: "2017-01-03", charge: "100", name: "张奇", reachTime: "2017-01-02 12:00:00", totaltime: "1457076"} ]}, {time: "2017-01-02",money:'1000', file:[ {Time: "2017-01-02", charge: "800", name: "张奇", reachTime: "2017-01-04 09:30:00", totaltime: "7599000"} ]}, {time: "2017-01-01",money:'800', file:[ {Time: "2017-01-01", charge: "800", name: "张奇", reachTime: "2017-01-04 09:30:00", totaltime: "7599000"} ]}, ]
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
上面变成下面的数据都没有规律别人怎么帮你?
谢谢,你是个好人。