Here you can find the source of getYear()
public static int getYear()
//package com.java2s; //License from project: LGPL import java.util.*; public class Main { /**//from w w w . ja v a2 s . c o m * Year=1 * */ public static final int YEAR = Calendar.YEAR; public static int getYear() { Calendar calendar = Calendar.getInstance(); return calendar.get(Calendar.YEAR); } public static int getYear(final Date date) { Calendar calendar = Calendar.getInstance(); calendar.setTime(date); return calendar.get(Calendar.YEAR); } }