java.time.YearMonth.minusYears() 方法示例 java.time.YearMonth.minusMonths() 方法示例 java.time.YearMonth.now() 方法示例 java.time.YearMonth.minusYears() 方法示例 package com.codingdict; import java.time.YearMonth; import java.time.temporal.ChronoField; public class YearMonthDemo { public static void main(String[] args) { YearMonth date = YearMonth.of(2017,12); System.out.println(date.get(ChronoField.YEAR)); System.out.println(date.minusYears(4).get(ChronoField.YEAR)); } } java.time.YearMonth.minusMonths() 方法示例 java.time.YearMonth.now() 方法示例