通过给定的秒级时间戳,来算出n天后的时间戳,或者是字符串
java8之前的时间api存在闰秒问题,所以如果要获取到准确的时间戳,最好用java8api,不要用当前时间戳加上每天的秒数来算.
private String getDelayDaysString(Long stratTime, Integer n) {
LocalDateTime localDateTime = LocalDateTime.ofInstant(Instant.ofEpochSecond(stratTime), getChinaZone());
LocalDateTime time = localDateTime.plusDays(n);
return time.toString();
}
private static ZoneOffset getChinaZone() {
return ZoneOffset.of("+8");
}