Close

Java Date Time - LocalDateTime.isBefore() Examples

Java Date Time Java Java API 


Class:

java.time.LocalDateTime

java.lang.Objectjava.lang.Objectjava.time.LocalDateTimejava.time.LocalDateTimejava.time.temporal.TemporalTemporaljava.time.temporal.TemporalAdjusterTemporalAdjusterjava.time.chrono.ChronoLocalDateTimeChronoLocalDateTimejava.io.SerializableSerializableLogicBig

Method:

public boolean isBefore(ChronoLocalDateTime<?> other)

If this date-time is before the specified date-time, this method will return true, otherwise will return false.



Examples


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);
}
}

Output

true




See Also