Period minusYears(long yearsToSubtract)
returns a copy of this period with the specified years subtracted.
minusYears
has the following syntax.
public Period minusYears(long yearsToSubtract)
The following example shows how to use minusYears
.
import java.time.Period; /* ww w . j av a 2s . c o 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.