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
Calendar
does not function as you expect it to. From the JavaDoc:Notice that the documentation states a
specific instant in time
. This implies theCalendar
can only be based off of one point in time from epoch.When you use the
set
method you are adjusting thespecific instant in time
through each call. So first it gets set to Monday then Wednesday.You could use a
List<Calendar>
to store multipleCalendar
instances set to your desired days.