Pass the year information to the calendar object
import java.util.Calendar; public class Main { public static void main(String[] argv) throws Exception { int year = 2004; Calendar calendar = Calendar.getInstance(); calendar.set(Calendar.YEAR, year); } }