import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
private static final DateTimeFormatter FMT = DateTimeFormatter.ofPattern("yyyyMMdd");
String currentTime = FMT.format(LocalDateTime.now());
String currentTime = LocalDateTime.now().format(FMT);
int currentHour = LocalDateTime.now().getHour();
String beforeTime = FMT.format(LocalDateTime.now().minusDays(1))
String afterTime = FMT.format(LocalDateTime.now().plusDays(1)
minusYears()、
plusMinutes()...
LocalDateTime localDateTime = LocalDateTime.of(LocalDate.now(), LocalTime.MIN)
Long localTimestamp = localDateTime.toEpochSecond(ZoneOffset.of("+8")) * 1000;
LocalDateTime localDateTime = LocalDateTime.of(localDateTime.getYear(), localDateTime.getMonthValue(), localDateTime.getDayOfMonth(), localDateTime.getHour(), 0, 0);
public String transferFormat(String date) {
DateTimeFormatter oldFormat = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
LocalDateTime tempDate = LocalDateTime.parse(date, oldFormat);
DateTimeFormatter newFormat = DateTimeFormatter.ofPattern("yyyyMMdd");
String newDate = tempDate.format(newFormat);
return newDate;
}