in Education by (55.8k points)

How will you get second saturday of next month using java8 in Java8?

1 Answer

0 votes
by (55.8k points)

How will you get second saturday of next month using java8 in Java8?

Following code gets second saturday of next month using java8 -

//get the second saturday of next month

LocalDate firstInYear = LocalDate.of(date1.getYear(),date1.getMonth(), 1);

LocalDate secondSaturday = firstInYear.with(TemporalAdjusters.nextOrSame(DayOfWeek.SATURDAY)).with(TemporalAdjusters.next(DayOfWeek.SATURDAY));

System.out.println("Second Saturday on : " + secondSaturday);

Related questions

0 votes
asked Nov 8, 2020 in Education by Editorial Staff (55.8k points)
...