Java tutorial
import java.util.Calendar; import java.util.Date; public class Main { public static void main(String[] argv) { System.out.println(getYear(new Date())); } public static Integer getYear(Date date) { if (date == null) return 0; Calendar cal = Calendar.getInstance(); cal.setTime(date); return cal.get(Calendar.YEAR); } }