JS - 2020-01-01T00:00:00.000000Z 日期格式转换

function rTime(date) {
var json_date = new Date(date).toJSON();
return new Date(new Date(json_date) + 8 * 3600 * 1000).toISOString().replace(/T/g, ' ').replace(/\.[\d]{3}Z/, '')
}
let date = rTime('2020-06-27T14:20:27.000000Z');
console.log(date) // 2020-06-27 14:20:27

源地址 

JS - 2020-01-01T00:00:00.000000Z 日期格式转换 - sanyekui - 博客园 (cnblogs.com)

 

posted @ 2022-01-27 13:13  黑月SAMA  阅读(474)  评论(0编辑  收藏  举报