I was trying to get the hours between two local dates. And I used the code below :
LocalDate startDate = LocalDate.of(2000, 4, 30);
long noOfHours = startDate.until(LocalTime.now(), ChronoUnit.HOURS);
System.out.println(noOfHours);
I am having the error below :
Exception in thread "main" java.time.DateTimeException: Unable to obtain LocalDate from TemporalAccessor: 13:44:53.095819600 of type java.time.LocalTime
at java.base/java.time.LocalDate.from(LocalDate.java:397)
at java.base/java.time.LocalDate.until(LocalDate.java:1645)
at BirthDay.App.main(App.java:36)