I use the java Duration between method to calcul a duration between to a LocalTime and LocalDateTime it's work when I put the localTime as the first argument of the method but when I reversed the order it gave an exception DateTimeException :
This work fine :
LocalTime t1 = LocalTime.now();
LocalDateTime t2 = LocalDateTime.now();
System.out.println(Duration.between(t1, t2));
When I reversed the agrs it gave me an exception :
LocalTime t1 = LocalTime.now();
LocalDateTime t2 = LocalDateTime.now();
System.out.println(Duration.between(t2, t1));
Exception in thread "main" java.time.DateTimeException: Unable to obtain LocalDateTime from TemporalAccessor: 16:32:18.553 of type java.time.LocalTime
can someone explain why I get this exception thanks for any help :=)