java.time.Year.parse(CharSequence text, DateTimeFormatter formatter) java.time.Year.parse() 方法示例 java.time.Year.plus() 方法示例 java.time.Year.parse(CharSequence text, DateTimeFormatter formatter) package com.codingdict; import java.time.Year; import java.time.format.DateTimeFormatter; public class YearDemo { public static void main(String[] args) { DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yy"); String dateString = "17"; Year date = Year.parse(dateString, dateTimeFormatter); System.out.println(date); } } java.time.Year.parse() 方法示例 java.time.Year.plus() 方法示例