I have a particular date format.I can subtract 2 dates but I can't achieve to subtract today's date from a future one.
I found the way to get today's date
DateTimeFormatter dtf = DateTimeFormatter.ofPattern("dd/MM/yyyy");
LocalDateTime now = LocalDateTime.now();
System.out.println(dtf.format(now));
Here is the way I subtract 2 dates(Strings)
public boolean DateDiff(String datep,String dater) {
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("dd/MM/yyyy");
LocalDate date1 = LocalDate.parse(datep, formatter);
LocalDate date2 = LocalDate.parse(dater, formatter);
long elapsedDays = ChronoUnit.DAYS.between(date1, date2);
I can't turn the current day to a String so I can have 2 same types of variables to subtract.What kind of type is the LocalDateTime now