Home Java LocalDateTime Methods plusDays() Java LocalDateTime plusDays() Method Definition In Java, plusDays(days) returns a new LocalDateTime that is the given number of days later than the original. The time of day stays exactly the same.
LocalDateTime is immutable , so the original object never changes. Always keep the result: dt = dt.plusDays(1);. This is how you work out a delivery date, a due date, or "tomorrow".
An instance method of java.time.LocalDateTime (since Java 8): call it on a LocalDateTime object. Add import java.time.LocalDateTime; at the top of your file.
Syntax Call it on a LocalDateTime and pass the number of days. A negative number goes the other way.
LocalDateTime start = LocalDateTime.of(2026, 3, 15, 10, 30);
LocalDateTime result = start.plusDays(3); // 2026-03-18T10:30
System.out.println(start); // 2026-03-15T10:30 Call What it does dt.plusDays(n)Returns a new date-time with n days added. dt.minusDays(n)The same idea in the opposite direction. dt.plus(n, ChronoUnit.DAYS)The general form. It does the same thing for this unit. date.plusDays(n)LocalDate has the same method, but it has no time of day.
The result is a new object . Calling plusDays() without using the returned value does nothing useful.
Library declarations // java.time.LocalDateTime
public LocalDateTime plusDays(long days) Parameters Parameter Description days (long)The number of days to add. It can be zero or negative.
Return Value Return Value Description LocalDateTimeA new LocalDateTime with the days added. The original is not changed.
Important
Days are calendar days, so the month and the year change by themselves when needed: 31 January plus 1 day is 1 February. A LocalDateTime has no time zone, so there is no daylight saving rule to worry about, and adding 1 day always keeps the same clock time. If the result is outside the supported range, a DateTimeException is thrown.
Compare with Similar Methods Methods that move a date-time in time:
Java Examples 1. Delivery date 2. Month and year rollover 3. Keep the result Example 1 — Work Out a Delivery Date An order is placed on a Sunday morning and arrives three days later. Add the days and print both dates.
import java.time.LocalDateTime;
public class LdtPlusDaysDemo {
public static void main(String[] args) {
LocalDateTime ordered = LocalDateTime.of(2026, 3, 15, 10, 30);
LocalDateTime delivery = ordered.plusDays(3);
System.out.println("ordered: " + ordered);
System.out.println("delivery: " + delivery);
}
} ordered: 2026-03-15T10:30
delivery: 2026-03-18T10:30 How It Works The order time. LocalDateTime.of(2026, 3, 15, 10, 30) is 15 March 2026 at 10:30.Add three days. plusDays(3) moves the date to the 18th and keeps the time at 10:30.A new object. The result is stored in delivery, a different object from ordered.The original is unchanged. Printing ordered still shows the 15th.Example 2 — See the Month and Year Roll Over Add days across the end of February, the end of the year, and a leap day.
import java.time.LocalDateTime;
public class LdtPlusDaysRollover {
public static void main(String[] args) {
LocalDateTime feb = LocalDateTime.of(2026, 2, 27, 9, 0);
LocalDateTime dec = LocalDateTime.of(2026, 12, 30, 18, 0);
LocalDateTime leap = LocalDateTime.of(2024, 2, 28, 12, 0);
System.out.println("27 Feb + 2 days: " + feb.plusDays(2));
System.out.println("30 Dec + 5 days: " + dec.plusDays(5));
System.out.println("28 Feb 2024 + 1: " + leap.plusDays(1));
}
} 27 Feb + 2 days: 2026-03-01T09:00
30 Dec + 5 days: 2027-01-04T18:00
28 Feb 2024 + 1: 2024-02-29T12:00 How It Works February 2026 has 28 days. Two days after the 27th is 1 March, so the month changes.The year changes too. Five days after 30 December lands on 4 January 2027.Leap years are handled. 2024 is a leap year, so the day after 28 February is 29 February.The time never moves. Each result keeps the hour and minute of the original.Example 3 — Do Not Forget to Keep the Result Call plusDays and throw the answer away, then call it again and keep the answer.
import java.time.LocalDateTime;
public class LdtPlusDaysTrap {
public static void main(String[] args) {
LocalDateTime meeting = LocalDateTime.of(2026, 3, 16, 14, 0);
meeting.plusDays(1);
System.out.println("ignored the result: " + meeting);
meeting = meeting.plusDays(1);
System.out.println("kept the result: " + meeting);
}
} ignored the result: 2026-03-16T14:00
kept the result: 2026-03-17T14:00 How It Works A meeting on Monday at 14:00. The variable meeting points to that date-time.The first call is wasted. plusDays(1) builds a new object, but nothing stores it, so meeting still shows the 16th.The second call is assigned back. meeting = meeting.plusDays(1) makes the variable point to the new object.Now the date moves. The last line shows the 17th.Frequently Asked Questions How do I add days to a LocalDateTime in Java? Call dt.plusDays(n). It returns a new LocalDateTime, so store it: dt = dt.plusDays(n).
Does plusDays() change the original LocalDateTime? No. LocalDateTime is immutable, so plusDays() returns a new object and leaves the original as it was.
Can I pass a negative number to plusDays()? Yes. A negative number moves the other way, so dt.plusDays(-n) gives the same result as dt.minusDays(n).
How do I get tomorrow's date and time in Java? Use LocalDateTime.now().plusDays(1). It gives the same time of day, one day later.
What is the difference between plusDays() and plusHours(24)? For a LocalDateTime they give the same result, because there is no time zone and so no daylight saving change. With a ZonedDateTime they can differ.
About the author Developer, cloud engineer, and technical writer
I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.
9 people found this page helpful
Helpful Share Copy link Suggestion