Basically I am trying to create a list of all the dates for a week from a set date and store it in a String[]
array. But I am having some trouble.
So basically, today is 09/03/2016 so in the String[]
array I want to store:
09/03/2016
10/03/2016
11/03/2016
12/03/2016
13/03/2016
14/03/2016
15/03/2016
This is my code:
Calendar calendar = Calendar.getInstance();
calendar.add(Calendar.DAY_OF_WEEK, calendar.getFirstDayOfWeek() - calendar.get(Calendar.DAY_OF_WEEK));
String[] weekly = new String[7];
Arrays.fill(weekly, "");
int today = calendar.getInstance().get(Calendar.DAY_OF_WEEK);
for(int i=today; i <= today-1; i++){
weekly[i] = Integer.toString(i);
System.out.println(i);
}
Would be great if someone could help me out