Java tutorial
import java.time.YearMonth; import java.time.temporal.ChronoField; public class Main { public static void main(String[] args) { YearMonth y = YearMonth.now(); long m = y.getLong(ChronoField.YEAR); System.out.println(m); } }