Here you can find the source of getYear()
public static int getYear()
//package com.java2s; //License from project: Apache License import static java.util.Calendar.*; import java.util.*; public class Main { public static int getYear() { return getYear(new Date()).intValue(); }// w w w. jav a 2 s . c om public static Integer getYear(Date date) { if (date == null) { return null; } Calendar ca = Calendar.getInstance(); ca.setTime(date); return Integer.valueOf(ca.get(YEAR)); } }