Here you can find the source of year(int month, int day, int hour, int minute, int second)
public static Date year(int month, int day, int hour, int minute, int second)
//package com.java2s; //License from project: Artistic License import java.util.Calendar; import java.util.Date; import java.util.GregorianCalendar; import java.util.TimeZone; public class Main { public static Date year(int month, int day, int hour, int minute, int second) { Calendar now = now();/*from www . ja va 2s .c o m*/ return new GregorianCalendar(now.get(Calendar.YEAR), month, day, hour, minute, second).getTime(); } public static Calendar now() { Calendar now = new GregorianCalendar(); now.setTimeInMillis(new Date().getTime()); now.setTimeZone(TimeZone.getDefault()); return now; } }