You can add days/weeks/months/years to the Java Date Time API LocalDate class object using the below methods,
- plus(TemporalAmount amountToAdd): returns LocalDate
- plus(long amountToAdd, TemporalUnit unit): returns LocalDate
- plusDays(long daysToAdd): returns LocalDate
- plusWeeks(Long weeksToAdd): returns LocalDate
- plusMonths(long monthsToAdd): returns LocalDate
- plusYears(long yearsToAdd): returns LocalDate

Let's take a look at the code example,
package org.code2care;
import java.time.LocalDate;
import java.time.temporal.ChronoUnit;
public class Java8AddDaysToDate {
public static void main(String[] args) {
LocalDate localDateToday = LocalDate.now();
System.out.println("Today: " + localDateToday);
//Adding one day to today
System.out.println("Today + 1 day = "+ localDateToday.plusDays(1));
//Adding one week to today
System.out.println("Today + 1 week = "+ localDateToday.plusWeeks(1));
//Adding one month to today
System.out.println("Today + 1 month = "+ localDateToday.plusMonths(1));
//Adding one year to today
System.out.println("Today + 1 year = "+ localDateToday.plusYears(1));
//Adding days/weeks/months/years using plus(long amountToAdd, TemporalUnit unit)
System.out.println("Today + 10 days = "+ localDateToday.plus(10, ChronoUnit.DAYS));
System.out.println("Today + 10 weeks = "+ localDateToday.plus(10, ChronoUnit.WEEKS));
System.out.println("Today + 10 months = "+ localDateToday.plus(10, ChronoUnit.MONTHS));
System.out.println("Today + 10 years = "+ localDateToday.plus(10, ChronoUnit.YEARS));
}
}
Output:
Today: 2022-05-14
Today + 1 day = 2022-05-15
Today + 1 week = 2022-05-21
Today + 1 month = 2022-06-14
Today + 1 year = 2023-05-14
Today + 10 days = 2022-05-24
Today + 10 weeks = 2022-07-23
Today + 10 months = 2023-03-14
Today + 10 years = 2032-05-14
More Posts related to Java,
- CRUD operations in Spring Boot + JDBC
- Java Check Leap Year - Programs with Code Examples
- [fix] Java JDBC ConnectException: Connection refused
- How to add hours and minutes to Java Instant
- Java Program: Random Number Generator
- Java: The value of the local variable string is not used
- How to get list of all Java versions installed on macOS
- Java SE JDBC with Prepared Statement Parameterized Select Example
- Java + Spring JDBC Template + Gradle Example
- Convert String to LocalDate in Java
- Remove Trailing zeros BigDecimal Java
- Java 8 Predicate Functional Interface isEqual() Method Example
- How to Hardcode Date in Java with Examples
- Java 8: Predicate negate() default Function Example
- Java: Collect Stream as ArrayList or LinkedList
- The Motivation Behind Generics in Java Programming
- How to Add/Subtract Days to the Current Date in Java
- Error: Can not find the tag library descriptor for
- Setting up JUnit 5 dependency with Maven Example
- Run Java Code Every Second
- How to create a tar.gz file using Java
- [Fix] java: integer number too large compilation error
- Java 8: Find the Max value in a List
- Your JBoss Application Server 7 is running However you have not yet added any users to be able to access the admin console
- Convert Java Array to ArrayList Code Example
More Posts:
- Resolve - zsh: command not found: code - zsh
- How to turn off CR LF CRLF in Notepad++ - NotepadPlusPlus
- Rust: Write and Run Hello World! Program Example - Rust
- [Java] Error: Unmappable character for encoding UTF-8. Save could not be completed. - Java
- Change Current User Password using Mac Terminal Command - MacOS
- 25: How to rename a file using Python Program - Python-Programs
- Android Emulator] ##KBD: Full queue, lose event Error Logs - Android
- How to list all tables using Java JDBC - Java