java – Checking if a calendar day exists


I have 3 int numbers: year, month, day which should correspond to the day of the calendar.

Is it possible using any standard libraries to check that such a calendar day exists?


public static boolean isDateValid(int year, int month, int day) {
    boolean dateIsValid = true;
    try {
        LocalDate.of(year, month, day);
    } catch (DateTimeException e) {
        dateIsValid = false;
    return dateIsValid;
Scroll to Top