标签云

微信群

扫码加入我们

WeChat QR Code

This question already has answers here:How do I format a Microsoft JSON date?(40 answers)Closed 5 years ago.Am working with json api that represents dates like this "date" : "/Date(1356081900000)/"I want to turn this into regular javascript Date.The only way I can think of solving this problem is to do a replace on everything leaving the timestamp which I can then "convert".This works but it just looks wrong.My question. Can I do this in better way?UPDATE unix_timestamp = jsonDate.replace('/Date(', '').replace(')/', ''); newDate = new Date(+unix_timestamp + 1000*3600);


Did you see this other post?Convert a Unix timestamp to time in Javascript

2019年12月07日40分18秒

this works for me, ten a simple return t.toLocaleDateString() + ' ' + t.toLocaleTimeString();in my function

2019年12月07日40分18秒