I want to get today's day and a date which is one year after today. For example, if today is 2015-9-18, next year is 2016-9-18.
I would like to use Java LocalDate.
The current date is simply retrieved with:
LocalDate now = LocalDate.now();
Then, you can add one year to this date, using the method plusYears(years):
LocalDate oneYearAfter = now.plusYears(1);
LocalDate contains various methods to ease the task of adding or subtracting a temporal amount (like plusDays, plusMonths; the most general being plus(amount, unit) adding the amount given for the specified unit of time).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With