This method returns a copy of this period with the specified months added.
package com.logicbig.example.period;
import java.time.Period;
public class PlusMonthsExample {
public static void main(String... args) {
Period p = Period.of(10, 2, 13);
System.out.println(p);
Period p2 = p.plusMonths(30);
System.out.println(p2);
Period p3 = p.plusMonths(-30);
System.out.println(p3);
}
}
Output
P10Y2M13D
P10Y32M13D
P10Y-28M13D