test date in java
DateTimeFormatter dtf = DateTimeFormatter.ofPattern("dd-MM-yyyy");
String inputString1 = "23-01-1997";
String inputString2 = "27-04-1997";
try {
LocalDateTime date1 = LocalDate.parse(inputString1, dtf);
LocalDateTime date2 = LocalDate.parse(inputString2, dtf);
long daysBetween = Duration.between(date1, date2).toDays();
System.out.println ("Days: " + daysBetween);
} catch (ParseException e) {
e.printStackTrace();
}