0 votes
in Education by (55.6k points)

How will you get next tuesday using java8 in Java8?

1 Answer

0 votes
by (55.6k points)

How will you get next tuesday using java8 in Java8?

Following code gets next tuesday using java8 -

//get the next tuesday

LocalDate today = LocalDate.now();

LocalDate nextTuesday = today.with(TemporalAdjusters.next(DayOfWeek.TUESDAY));

System.out.println("Next Tuesday on : " + nextTuesday);

...