UTC 时间转化为北京时间
// UTC 时间转化为北京时间 function utc2beijing(utcTime) { var T_pos = utcTime.indexOf(\'T\'); var Z_pos = utcTime.indexOf(\'Z\'); var year_month_day = utcTime.substr(0,T_pos); var hour_minute_second = utcTime.substr(T_pos+1,Z_pos-T_pos-1); var new_datetime = year_month_day+" "+hour_minute_second; // 2017-03-31 08:02:06 // 处理成为时间戳 timestamp = new Date(Date.parse(new_datetime)); timestamp = timestamp.getTime(); timestamp = timestamp/1000; // 增加8个小时,北京时间比utc时间多八个时区 var timestamp = timestamp+8*60*60; // 时间戳转为时间 const bjTime = new Date(parseInt(timestamp) * 1000).toLocaleString().replace(/\//g, \'.\').replace(/[\u4e00-\u9fa5]/g, \'\'); return bjTime; } // utc2beijing(\'2020-04-17T02:31:04.000000Z\') // "2020.4.17 10:31:04"