/** * 將Long類型轉化成0 * @author yk * @param time * @return */public static ZonedDateTime toZonedDateTime(Long time){ SimpleDateFormat sdf = new SimpleDateFormat(LONG_DATE); Date createDate = new Date(time); String format = sdf.format(createDate); DateTimeFormatter beijingFormatter = DateTimeFormatter.ofPattern(LONG_DATE).withZone(ZoneId.of("Asia/Shanghai")); if(StringUtils.isBlank(format)){ return null; } ZonedDateTime beijingDateTime = ZonedDateTime.parse(format, beijingFormatter); ZonedDateTime utc = beijingDateTime.withZoneSameInstant(ZoneId.of("UTC")); return utc;}