Java LocalDate plusDays() Method
Example
Add 20 days to a date:
import java.time.LocalDate;
public class Main {
public static void main(String[] args) {
LocalDate myDate = LocalDate.of(2026, 1, 15);
LocalDate later = myDate.plusDays(20);
System.out.println(myDate);
System.out.println(later);
}
}
Definition and Usage
The plusDays() method returns a new date, a number of days after the original date. The month and the year change when needed.
The original date is not changed. A LocalDate object is immutable (it cannot be changed after it is created), so the method returns a new object.
Tip: Use the minusDays() method to go back a number of days.
Syntax
public LocalDate plusDays(long daysToAdd)
Parameter Values
| Parameter | Description |
|---|---|
| daysToAdd | Required. The number of days to add. It can be negative. |
Technical Details
| Returns: | A new LocalDate object with the days added. |
|---|
Related Pages
❮ Date and Time Methods