1.

How Will You Add 1 Week To Current Date Using Local Datetime Api Of Java8?

Answer»

Following CODE ADDS 1 week to current DATE USING local datetime api −

//ADD 1 week to the current date
LocalDate today = LocalDate.now();
LocalDate nextWeek = today.plus(1, ChronoUnit.WEEKS);
System.out.println("Next week: " + nextWeek);

Following code adds 1 week to current date using local datetime api −

//add 1 week to the current date
LocalDate today = LocalDate.now();
LocalDate nextWeek = today.plus(1, ChronoUnit.WEEKS);
System.out.println("Next week: " + nextWeek);



Discussion

No Comment Found