LocalDateTime与时间戳转换
//时间戳转时间
public static LocalDateTime parseDefault(long timestamp) {
return LocalDateTime.ofInstant(Instant.ofEpochSecond(timestamp), ZoneId.systemDefault());
}
//时间转时间戳
public static long getTimestampOfDateTime(LocalDateTime localDateTime) {
ZoneId zone = ZoneId.systemDefault();
Instant instant = localDateTime.atZone(zone).toInstant();
return instant.getEpochSecond();
}