【发布时间】:2015-08-05 07:41:31
【问题描述】:
我有一个使用 AJAX 的 JSON js 对象。 问题是我对后端没有太多控制权,所以数据来自简单的 JS 对象。
我有一个如下的 JSON 文件
var test =
[
{value : 23,
file_date : Wed Jan 01 2014 05:34:53 GMT+0530 (IST)
},
{value : 23,
file_date : Wed Jan 01 2014 09:34:53 GMT+0530 (IST)
},
{value : 23,
file_date : Wed Jan 01 2014 02:34:53 GMT+0530 (IST)
},
{value : 23,
file_date : Wed Jan 02 2014 06:34:53 GMT+0530 (IST)
},
{value : 23,
file_date : Wed Jan 02 2014 09:34:53 GMT+0530 (IST)
},
{value : 23,
file_date : Wed Jan 02 2014 04:34:53 GMT+0530 (IST)
},
{value : 23,
file_date : Wed Jan 03 2014 02:34:53 GMT+0530 (IST)
},
{value : 23,
file_date : Wed Jan 03 2014 01:34:53 GMT+0530 (IST)
},
{value : 23,
file_date : Wed Jan 03 2014 10:34:53 GMT+0530 (IST)
},
{value : 23,
file_date : Wed Jan 04 2014 7:34:53 GMT+0530 (IST)
},
{value : 23,
file_date : Wed Jan 05 2014 10:34:53 GMT+0530 (IST)
},
{value : 23,
file_date : Wed Jan 06 2014 11:34:53 GMT+0530 (IST)
}
]
file_ts 有不同的时间戳。我的问题是我必须整合这些数据。
如果用户选择 1 天,那么我必须按小时获取所有数据的总和。如果 2 到 3 小时之间有 4 个值,那么我必须按小时对这些数据求和。
然后如果每周然后每周。我正在尝试使用 express 和 mysql 编写 nodejs 服务器,但它也无法从那里工作。
【问题讨论】:
-
向我们展示您的尝试,这与其说是一个问题,不如说是一个工作规范。
-
我无法为此实现任何东西。我的解决方案是不同的。这刚刚出现,因为后端不在我的控制之下。我很难过
标签: javascript jquery node.js date momentjs