我有一个jQuery表,其中的列包含以毫秒为单位的日期格式。我想从毫秒转换为mm / dd / yyyy。我还没有弄清楚如何转换日期值并将其集成到我的脚本中。
请查看我的小提琴并提供您可能提出的任何建议:http://jsfiddle.net/tommy6s/eLbq2wvh/
$(document).ready(function() {
$.getJSON("http://www.corsproxy.com/dvl.thomascooper.com/data/json_return.json", function(data) {
//static table head
$('table.stats').append("<th>" + "</th>" + "<th>" + "Date" + "</th>" + "<th>" + "Brand" + "</th>" + "<th>" + "Author" + "</th>" + "<th>" + "Title" + "</th>" + "<th>" + "Posts" + "</th>" + "<th>" + "Exposure" + "</th>" + "<th>" + "Engagement" + "</th>");
//loop through json data
$.each(data.data.rows, function(i, val) {
//+1 to number each row starting at 1
var rowNum = i + 1;
//create table rows and cell and populate with data
$('table.stats').append("<tr>" + "<td>" + rowNum + "</td>" + "<td>" + val[0].value + "</td>" + "<td>" + val[1].value + "</td>" + "<td>" + val[2] + "</td>" + "<td>" + val[3].label + "</td>" + "<td>" + val[4].values[0] + "</td>" + "<td>" + val[5].values[0] + "</td>" + "<td>" + val[6].values[0] + "</td>" + "</tr>");
});
});
});
答案 0 :(得分:0)