后台直接傳來的時間是這樣的
需要轉換為標准時間格式
代碼如下:
使用了layui數據表格的模板列
{ field: 'RegistTime', title: '注冊時間', templet: function (d) { return TimeFormat(d.RegistTime) } }
function TimeFormat(timestamp)
{
var time = new Date(parseInt(timestamp.substring(6, 19)))
var year = time.getFullYear();
var month = time.getMonth() + 1;
var date = time.getDate();
var hour = time.getHours();
var minute = time.getMinutes();
var second = time.getSeconds();
return year + "/" + month + "/" + date + " " + hour + ":" + minute + ":" + second;
}
效果如下