in Education by (55.8k points)

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

1 Answer

0 votes
by (55.8k points)

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

Following code adds 1 month to current date using local datetime api:

//add 1 month to the current date

LocalDate today = LocalDate.now();

LocalDate nextMonth = today.plus(1, ChronoUnit.MONTHS);

System.out.println("Next month: " + nextMonth);

Related questions

0 votes
asked Nov 8, 2020 in Education by Editorial Staff (55.8k points)
...