in Education by

How will you add 1 week to current date using local datetime api of java8 in Java8?

Please log in or register to answer this question.

1 Answer

0 votes
by

How will you add 1 week to current date using local datetime api of java8 in Java8?

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

Related questions

0 votes
asked Nov 8, 2020 in Education by Editorial Staff
0 votes
asked Apr 7, 2022 in Education by JackTerrance
0 votes
asked Nov 8, 2020 in Education by Editorial Staff
...