Java Date Time Java Java API
java.time.LocalDateTime
public boolean isBefore(ChronoLocalDateTime<?> other)
If this date-time is before the specified date-time, this method will return true, otherwise will return false.
package com.logicbig.example.localdatetime;import java.time.LocalDateTime;import java.time.Month;public class IsBeforeExample { public static void main (String... args) { LocalDateTime d = LocalDateTime.of(1989, Month.JANUARY, 1, 22, 20); boolean b = d.isBefore(LocalDateTime.of(1990, 1, 2, 10, 20)); System.out.println(b); }}
true