views:

137

answers:

2

Having the hours and minutes, is there any easier or better way to set it into a Calendar object than:

calendar.set(calendar.get(Calendar.YEAR),
                        calendar.get(Calendar.MONTH),
                        calendar.get(Calendar.DAY_OF_MONTH),
                        hour, minute);
+1  A: 

Use set(int field, int value). The first parameter is the field number for HOUR/MINUTE/SECOND.

Rahul
+8  A: 

From here:

calendar.set(Calendar.HOUR, hour);
calendar.set(Calendar.MINUTE, minute);
Peter