Java LocalDateTime plusDays() Method

Beginner
5 min read
Updated: Nov 2026
3 examples
Java 8+

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.

Java
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
CallWhat 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
// java.time.LocalDateTime
public LocalDateTime plusDays(long days)

Parameters

ParameterDescription
days (long)The number of days to add. It can be zero or negative.

Return Value

Return ValueDescription
LocalDateTimeA new LocalDateTime with the days added. The original is not changed.

Compare with Similar Methods

Methods that move a date-time in time:

MethodHow it differs
minusDays(n)The opposite direction for days.
plus(n, unit)The general method: you choose the unit as an argument.
plusWeeks(n)Adds whole weeks, 7 days each.
plusHours(n)Adds hours instead of days.

Java Examples

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.

Java
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);
    }
}

How It Works

  1. The order time. LocalDateTime.of(2026, 3, 15, 10, 30) is 15 March 2026 at 10:30.
  2. Add three days. plusDays(3) moves the date to the 18th and keeps the time at 10:30.
  3. A new object. The result is stored in delivery, a different object from ordered.
  4. 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.

Java
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));
    }
}

How It Works

  1. February 2026 has 28 days. Two days after the 27th is 1 March, so the month changes.
  2. The year changes too. Five days after 30 December lands on 4 January 2027.
  3. Leap years are handled. 2024 is a leap year, so the day after 28 February is 29 February.
  4. 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.

Java
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);
    }
}

How It Works

  1. A meeting on Monday at 14:00. The variable meeting points to that date-time.
  2. The first call is wasted. plusDays(1) builds a new object, but nothing stores it, so meeting still shows the 16th.
  3. The second call is assigned back. meeting = meeting.plusDays(1) makes the variable point to the new object.
  4. Now the date moves. The last line shows the 17th.

Frequently Asked Questions

Call dt.plusDays(n). It returns a new LocalDateTime, so store it: dt = dt.plusDays(n).
No. LocalDateTime is immutable, so plusDays() returns a new object and leaves the original as it was.
Yes. A negative number moves the other way, so dt.plusDays(-n) gives the same result as dt.minusDays(n).
Use LocalDateTime.now().plusDays(1). It gives the same time of day, one day later.
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.

Next: plusHours()

Return a copy that is a number of hours later.

plusHours() tutorial →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

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