Java Date Time - LocalDateTime plusDays(long days) example








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

Syntax

plusDays has the following syntax.

public LocalDateTime plusDays(long days)

Example

The following example shows how to use plusDays.

import java.time.LocalDateTime;
//from   w  w w.  ja  v  a2s.  co m
public class Main {
  public static void main(String[] args) {
    LocalDateTime a = LocalDateTime.of(2014, 6, 30, 12, 00);
    
    LocalDateTime t = a.plusDays(100);
    
    System.out.println(t);
  }
}

The code above generates the following result.