Java examples for java.util:Minute
set Hours Minutes And Seconds
import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Calendar; import java.util.Date; import java.util.GregorianCalendar; import java.util.List; import org.apache.log4j.Logger; public class Main{ public static void main(String[] argv) throws Exception{ Calendar cal = Calendar.getInstance(); int hours = 2; int minutes = 2; int seconds = 2; setHoursMinutesAndSeconds(cal,hours,minutes,seconds); }//from w w w.j a va 2 s .c o m public static void setHoursMinutesAndSeconds(Calendar cal, int hours, int minutes, int seconds) { cal.set(Calendar.HOUR_OF_DAY, hours); cal.set(Calendar.MINUTE, minutes); cal.set(Calendar.SECOND, seconds); cal.set(Calendar.MILLISECOND, 0); } }