MonthDay isBefore(MonthDay other) example

Description

MonthDay isBefore(MonthDay other) checks if this month-day is before the specified month-day.

Syntax

isBefore has the following syntax.


public boolean isBefore(MonthDay other)

Example

The following example shows how to use isBefore.


import java.time.Month;
import java.time.MonthDay;
/*from  ww  w .  j  av  a2s .  com*/
public class Main {
  public static void main(String[] args) {
    MonthDay m = MonthDay.now();
    
    System.out.println(m.isBefore(MonthDay.of(Month.APRIL, 1)));

  }
}

The code above generates the following result.





















Home »
  Java Date Time »
    java.time Reference »




Clock
DayOfWeek
Duration
Instant
LocalDate
LocalDateTime
LocalTime
Month
MonthDay
OffsetDateTime
OffsetTime
Period
Year
YearMonth
ZonedDateTime
ZoneId
ZoneOffset