List of usage examples for java.time.temporal TemporalAdjusters dayOfWeekInMonth
public static TemporalAdjuster dayOfWeekInMonth(int ordinal, DayOfWeek dayOfWeek)
From source file:Main.java
public static void main(String[] args) { LocalDate ld1 = LocalDate.of(2014, Month.MAY, 21); System.out.println(ld1);//w w w.ja v a 2s.c o m LocalDate ld2 = ld1.with(TemporalAdjusters.dayOfWeekInMonth(5, DayOfWeek.SUNDAY)); System.out.println(ld2); }
From source file:Main.java
private LocalDate getMartinLutherKingDayForDateInYear(int year) { return LocalDate.of(year, Month.JANUARY, 1).with(TemporalAdjusters.dayOfWeekInMonth(3, DayOfWeek.MONDAY)); }