To compare two dates in Java, use
before
and after
methods.Here's how you do it:
var juneSecond = new java.util.Date(122, java.util.Calendar.JUNE, 2);
var juneThird = new java.util.Date(122, java.util.Calendar.JUNE, 3);
System.out.println(juneThird.after(juneSecond)); // true
System.out.println(juneSecond.before(juneThird)); // true
System.out.println(juneThird.before(juneSecond)); // false