Period minusYears(long yearsToSubtract) example
Description
Period minusYears(long yearsToSubtract)
returns a copy of this period with the specified years subtracted.
Syntax
minusYears
has the following syntax.
public Period minusYears(long yearsToSubtract)
Example
The following example shows how to use minusYears
.
import java.time.Period;
/*ww w . j a va 2s. co m*/
public class Main {
public static void main(String[] args) {
Period p = Period.ofMonths(1);
Period l = p.minusYears(10);
System.out.println(l);
}
}
The code above generates the following result.