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

Open 1 Answers 25 Views Education

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

1 Answer

0

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

Following code adds 10 years to current date using local datetime api -

//add 10 years to the current date

LocalDate today = LocalDate.now();

LocalDate nextDecade = today.plus(1, ChronoUnit.DECADES);

System.out.println("Date after ten year: " + nextDecade);

by (53.7k points)
...