I am trying to create N
of weeks from the date given and the week list should exclude the week which belongs to the week.
for example if i give todays date then i would like to generate the week excluding this week to N
number of weeks.
below is the sample which serves my purpose but i am not able to create the N
number of weeks also this piece of code prints the current week.
Calendar currentDate = Calendar.getInstance(Locale.US);
int firstDayOfWeek = currentDate.getFirstDayOfWeek();
Calendar startDate = Calendar.getInstance(Locale.US);
startDate.setTime(currentDate.getTime());
int days = (startDate.get(Calendar.DAY_OF_WEEK) + 7 - firstDayOfWeek) % 7;
startDate.add(Calendar.DATE, -days);
Calendar endDate = Calendar.getInstance(Locale.US);
endDate.setTime(startDate.getTime());
endDate.add(Calendar.DATE, 6);
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
System.out.println(df.format(startDate.getTime()) + " - " + df.format(endDate.getTime()));
could some one help me on this?