import java.time.LocalDate; import java.time.LocalDateTime; import java.time.temporal.ChronoUnit; public class Test { @org.junit.jupiter.api.Test public void test1(){ LocalDate t1=LocalDateTime.now().toLocalDate(); LocalDate t2=LocalDateTime.now().toLocalDate().minusDays(1); System.out.println(t1); System.out.println(t2); System.out.println(ChronoUnit.DAYS.between(null, t1)); } }