客户端还原日期的方法:
new Date(parseInt(WriteTime.substr(6)))
var data =[{"post_date":"2015-04-10 01:55:27"},{"post_date":"2015-04-07 01:07:56"},{"post_date":"2014-09-06 05:47:27"},{"post_date":"2014-04-06 04:05:50"}]$.each(data, function(idx, obj) {
obj["post_date"] // ex: 2015-04-10 01:55:27 , 在此做时间比对後加入新的 json string 即可
})
如果你的数组如你所说的这样,可以用下面的方式,其实核心的东西没有变,只是获取的方法不同,var date = [
{"riqi":"2017-10-19","xinpai_db":"8","xinpai_gz":"8"},
{"riqi":"2017-10-20","xinpai_db":"3","xinpai_gz":"0"},
{"riqi":"2017-10-21","xinpai_db":"0","xinpai_gz":"0"}
]
for(var i=0i<date.lengthi++){
date[i]['riqi']= date[i]['riqi'].replace(/-/g,"/")
}