I need to set some days in method set. I try to use:
c.set(Calendar.DAY_OF_WEEK, Calendar.MONDAY);
c.set(Calendar.DAY_OF_WEEK, Calendar.WEDNESDAY);
but with this way set only Wednesday.
Thank you and sorry for my english :)
I need to set some days in method set. I try to use:
c.set(Calendar.DAY_OF_WEEK, Calendar.MONDAY);
c.set(Calendar.DAY_OF_WEEK, Calendar.WEDNESDAY);
but with this way set only Wednesday.
Thank you and sorry for my english :)
The
Calendardoes not function as you expect it to. From the JavaDoc:Notice that the documentation states a
specific instant in time. This implies theCalendarcan only be based off of one point in time from epoch.When you use the
setmethod you are adjusting thespecific instant in timethrough each call. So first it gets set to Monday then Wednesday.You could use a
List<Calendar>to store multipleCalendarinstances set to your desired days.