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

Open 1 Answers 41 Views Education

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

1 Answer

0

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);

by (53.7k points)
...