世界标准时间2020-04-30T04:16:26.000Z转换成2020-04-30 04:16:26
代码实现如下
// 录入时间格式转换
fromTime(timer) {
console.log(timer)
var jsonDate = new Date(timer).toJSON()
return new Date(new Date(jsonDate) + 8 * 3600 * 1000)
.toISOString()
.replace(/T/g, ' ')
.replace(/\.[\d]{3}Z/, '')
},
//转化之后的结果 2020-04-30 04:16:26