Home

plusDays

PlusDays is a date-time operation used in many programming libraries to create a new date or date-time that is a specified number of calendar days ahead of an existing one. It is most widely associated with Java’s java.time.LocalDate and LocalDateTime, as well as with other libraries such as Joda-Time. The method adds whole days, without requiring explicit handling of months or years.

The operation does not mutate the original object; it returns a new instance representing the result. It

Examples illustrate its behavior: for instance, adding one day to 2021-01-31 yields 2021-02-01, and adding -31

In common use, plusDays is often a convenience that aligns with broader plus methods (such as plusWeeks

accepts
a
long
value
indicating
the
number
of
days
to
add.
A
positive
value
moves
forward
in
time,
while
a
negative
value
moves
backward.
The
calculation
respects
calendar
rules,
including
month
lengths
and
leap
years,
automatically
rolling
over
to
subsequent
months
or
years
as
needed.
days
moves
backward
to
2020-12-31.
For
date-time
values,
plusDays
also
advances
the
time
along
with
the
date,
if
time
components
are
present
(e.g.,
2021-01-31T12:00
plus
one
day
becomes
2021-02-01T12:00).
or
plusMonths)
and
is
equivalent
to
adding
a
Period
of
days.
It
is
typically
complemented
by
minusDays
for
readability,
though
plusDays(-n)
achieves
the
same
result.