OffsetDateTime plusDays(long days) example

Description

OffsetDateTime plusDays(long days) returns a copy of this OffsetDateTime with the specified period in days added.

Syntax

plusDays has the following syntax.


public OffsetDateTime plusDays(long days)

Example

The following example shows how to use plusDays.


import java.time.OffsetDateTime;
// w  w  w.j  a  va 2 s . c o  m
public class Main {
  public static void main(String[] args) {
    OffsetDateTime o = OffsetDateTime.now();
    OffsetDateTime d =  o.plusDays(20);
    System.out.println(d);
  }
}

The code above generates the following result.





















Home »
  Java Date Time »
    java.time Reference »




Clock
DayOfWeek
Duration
Instant
LocalDate
LocalDateTime
LocalTime
Month
MonthDay
OffsetDateTime
OffsetTime
Period
Year
YearMonth
ZonedDateTime
ZoneId
ZoneOffset