I have two LocalTime
objects:
LocalTime l1 = LocalTime.parse("02:53:40");
LocalTime l2 = LocalTime.parse("02:54:27");
How can I found different in minutes between them?
I have two LocalTime
objects:
LocalTime l1 = LocalTime.parse("02:53:40");
LocalTime l2 = LocalTime.parse("02:54:27");
How can I found different in minutes between them?
Since Java 8 you can use
Duration
class. I think that gives the most elegant solution:Use
until
orbetween
, as described by the apiYou could do this:
I do this with ChronoUnit
Example
Output