Java Date Time - Period plusDays(long daysToAdd) example








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

Syntax

plusDays has the following syntax.

public Period plusDays(long daysToAdd)

Example

The following example shows how to use plusDays.

import java.time.Period;
/*from  w  w  w .ja va 2 s .c om*/
public class Main {
  public static void main(String[] args) {
    Period p = Period.ofMonths(1);
    
    Period l = p.plusDays(12);
    System.out.println(l);

  }
}

The code above generates the following result.