Example usage for java.time.temporal TemporalAdjusters lastInMonth

List of usage examples for java.time.temporal TemporalAdjusters lastInMonth

Introduction

In this page you can find the example usage for java.time.temporal TemporalAdjusters lastInMonth.

Prototype

public static TemporalAdjuster lastInMonth(DayOfWeek dayOfWeek) 

Source Link

Document

Returns the last in month adjuster, which returns a new date in the same month with the last matching day-of-week.

Usage

From source file:Main.java

private static LocalDate thanksgiving(int year) {
    LocalDate thanksGiving = Year.of(year).atMonth(Month.NOVEMBER).atDay(1)
            .with(TemporalAdjusters.lastInMonth(DayOfWeek.WEDNESDAY));
    return thanksGiving;
}