2021-08-24T02:29:01.282Z 日期格式转换为:2021-08-24 10:29:01

const timeDate = 2021-08-24T02:29:01.282Z
function rTime(timeDate) {
        var json_date = new Date(timeDate).toJSON();
        return new Date(+new Date(json_date) + 8 * 3600 * 1000).toISOString().replace(/T/g, ' ').replace(/\.[\d]{3}Z/, '')
}

你可能感兴趣的:(js)