1.

How Will You Get Next Tuesday Using Java8?

Answer»

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

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



Discussion

No Comment Found