Year isValidMonthDay(MonthDay monthDay) example

Description

Year isValidMonthDay(MonthDay monthDay) checks if the month-day is valid for this year.

Syntax

isValidMonthDay has the following syntax.


public boolean isValidMonthDay(MonthDay monthDay)

Example

The following example shows how to use isValidMonthDay.


import java.time.Month;
import java.time.MonthDay;
import java.time.Year;
/*from w  w  w .  j a v  a 2  s  . co  m*/
public class Main {
  public static void main(String[] args) {
    Year y = Year.of(2014);
    
    System.out.println(y.isValidMonthDay(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