java.time.YearMonth.until() 方法示例


java.time.YearMonth.until() 方法示例

package com.codingdict;

import java.time.YearMonth;
import java.time.temporal.ChronoUnit;

public class YearMonthDemo {
   public static void main(String[] args) {

      YearMonth date = YearMonth.parse("2015-12");
      YearMonth date1 = YearMonth.now();
      System.out.println(date.until(date1, ChronoUnit.YEARS));  
   }
}