Get all days of a current week?
<p>I need to get numbers of all days of a week (MON to SUN) based on which day is sent as a parameter. </p>

<p>For example,<br>
I pass May 2 and I get an array [30,1,2,3,4,5,6] which is this week actually.<br>
Or, I pass May 16 and I get an array [14,15,16,17,18,19,20]. </p>

<p>I tried to use this code, but it return 7 days from today, which I do not want. </p>

<pre><code>        //get which week of month
        Calendar now = Calendar.getInstance();
        now.set(mYear, mMonth, Integer.parseInt(extractedDay));
        int weekOfMonth = now.get(Calendar.WEEK_OF_MONTH);

        //get all days of clicked week
        SimpleDateFormat format = new SimpleDateFormat("MM/dd/yyyy");
        Calendar calendar = Calendar.getInstance();
        calendar.setFirstDayOfWeek(Calendar.MONDAY);
        calendar.set(mYear, mMonth, Integer.parseInt(extractedDay));

        String[] days = new String[7];
        for (int i = 0; i &lt; 7; i++)
        {
            days[i] = format.format(calendar.getTime());
            calendar.add(Calendar.DAY_OF_MONTH, 1);
        }
</code></pre>

<p>But this is not what I need. I need to pass today's day (THU) and to get dates of this week of May - Mon, Apr 30 to Sun, May 6.</p>

<p><strong>EDIT</strong></p>

<p>I realized that I have a code which detects which week of a month it is. Is there a way to use this data and to set a date for Monday? For example, I pass May 16 and then I detect that it's 3rd week of May, and the I set the variable <code>firstDayOfWeek</code> (a new variable) to May 14. </p>
