【发布时间】:2014-07-04 01:55:00
【问题描述】:
谁能帮帮我,这让我发疯。我是 Javascript 的初学者,现在我第一次遇到日期问题。
我已经问过了,但没有人回答我: json with parsed time or timestamp to amchartss
基本上我有这个 XHR 电话。
getJSON = function(url) {
var xhr = new XMLHttpRequest();
xhr.open('get', url, true);
xhr.responseType = 'json';
xhr.onload = function() {
var status = xhr.status;
if (status == 200) {
chartLoad(xhr.response);
console.log(xhr.response);
} else {
console.log("oh shit");
}
};
xhr.send();
};
我在这里收到带有时间戳的 JSON 文件的响应,我如何将所有时间戳转换为日期 YYYY-MM-DD HH:mm。
之前我直接在服务器上转换日期字符串而不是时间戳,这样我就不需要在客户端进行转换,但这种方式仅适用于 Chrome。
帮助!
【问题讨论】:
标签: javascript json xmlhttprequest amcharts