function formatDate(dt) {
var year = dt.getFullYear();
var month = dt.getMonth() + 1;
var date = dt.getDate();
var hour = dt.getHours();
var minute = dt.getMinutes();
var second = dt.getSeconds();
return year + "-" + month + "-" + date + " " + hour + ":" + minute + ":" + second;
}
function TestIt(time) {
//var Dtime = "\/Date(1408943415760+0800)\/";
var t = time.slice(6, 19)
//var d = eval('new ' + str.substr(1, str.length - 2));// 这样也可以转换成Date
var NewDtime = new Date(parseInt(t));
return formatDate(NewDtime);
}
console.log(TestIt("/Date(1518943415760+0800)/"));
//"2018-2-18 16:43:35"