Search code examples
javacompareequalslocaltime

How to compare time in Java LocalTime?


Given two LocalTime parameters in Java, I want to be able to compare the two times and see if they are equal (the same time). How would I do this?


Solution

  • Try:

    firstLocalTime.equals(secondLocalTime);
    

    .equals() is available for all Objects in Java.