Convert unix timestamp to javascript date Object [duplicate]

妖精的绣舞 提交于 2019-12-04 22:50:44
antila

Duplicate of How to format a JSON date?.

Accepted solution was:

var date = new Date(parseInt(jsonDate.substr(6)));

Try something like this:-

 var d = new Date(unix_timestamp*1000);

or

 var d = new Date([UNIX Timestamp] * 1000);

The Date constructor accepts a Unix timestamp.

function cleanDate(d) {
    return new Date(+d.replace(/\/Date\((\d+)\)\//, '$1'));
}

cleanDate("/Date(1356081900000)/"); // => Fri Dec 21 2012 04:25:00 GMT-0500 (EST)
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!