Date时区转换工具方法
/** * @Author * @Description 将UTC时区,转为北京时区 * @Date 2019/11/14 09:53 * @Param [dateStr:UTC时间字符串,格式:2018-08-07T01:00:59.000Z] * @Return java.util.Date **/ public static Date formatToBJDate(String dateStr) { SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'"); TimeZone utcZone = TimeZone.getTimeZone("UTC"); sf.setTimeZone(utcZone); try { Date date = sf.parse(dateStr); return date; } catch (Exception e) { return null; } }