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
- Create a Zip file using Java Code programmatically
- Eclipse : A java Runtime Environment (JRE) or Java Development kit (JDK) must be available
- How to Sort a LinkedList in Java
- Loading class com.mysql.jdbc.Driver. This is deprecated. The new driver class is com.mysql.cj.jdbc.Driver
- How to declare and initialize Array in Java Programming
- [Fix] java: integer number too large compilation error
- Java JDBC Connection with MySQL Driver in VS Code + Troubleshooting
- Reading .xls and .xlsx Excel file using Apache POI Java Library
- IntelliJ: Error: Could not find or load main class, java.lang.ClassNotFoundException
- How to get Client IP address using Java Code Example
- Truncate table using Java JDBC Example
- Struts 2 : There is no Action mapped for namespace [/] and action name [form] associated with context path [/proj]
- How to get file path in Idea IntelliJ IDE
- Java Generics explained with simple definition and examples
- Java SE 8 Update 301 available with various bug fixes and security improvements
- Java: Collect Stream as ArrayList or LinkedList
- Java JDBC Connection with PostgreSQL Driver Example
- How to check if Java main thread is alive
- How to fix Java nio NoSuchFileException wile reading a file
- Java 8+ get Day of the Week Examples with LocalDateTime, DateTime, ZonalDateTime and Instant classes
- Ways to Convert Integer or int to Long in Java
- [Java] How to throws Exception using Functional Interface and Lambda code
- [Fix] Spring Boot: mysql.cj.jdbc.exceptions.CommunicationsException: Communications link failure
- Java: The value of the local variable string is not used
- Java JDBC: Insert Java 8 LocalDate and Time using PreparedStatement
- SharePoint installation error - Setup is unable to proceed due to the following error This product requires Microsoft .Net Framework 4.5 - SharePoint
- Microsoft Office Excel - Couldnt Open the Workbook - The workbook cannot be opened. - Microsoft
- How to get cURL Command to run in verbose mode? - cURL
- How to: Docker Remove Image - Docker
- Install Eclipse IDE on M1 Mac Natively - Eclipse
- How to use Autocomplete and Autosuggestion in Shell Commands - Bash
- Disabling Spell Check in Android Studio - Android-Studio
- [Solution] com.amazonaws.dynamodb.v20120810 MissingAuthenticationToken Key Id or X.509 certificate - AWS