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

Open 1 Answers 19 Views Education

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

1 Answer

0

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

Following code adds 1 year to current date using local datetime api -

//add 1 year to the current date

LocalDate today = LocalDate.now();

LocalDate nextYear = today.plus(1, ChronoUnit.YEARS);

System.out.println("Next year: " + nextYear);

by (52.6k points)
...