title: Method to add Dates between 2 given dates?
body: <p>I'm working on a method that can add dates like this :</p>
  
  <pre><code>public static ArrayList&lt;Calendar&gt; addDaysBetween(Calendar day1, Calendar day2)
  </code></pre>
  
  <p>Which returns the ArrayList containing all the dates between d1 &amp; d2.</p>
  
  <p>So, first I needed to know how many days exists between those two dates (Followed this example : <a href="https://stackoverflow.com/a/28865648/4944071">https://stackoverflow.com/a/28865648/4944071</a>)</p>
  
  <p>I wrote something like this :</p>
  
  <pre><code>ArrayList&lt;Calendar&gt; fullDates = new ArrayList&lt;Calendar&gt;();
      if(daysBetween &gt; 0){
          for(int day = 1; day &lt;= daysBetween; day ++){
          Calendar aNewDay = new GregorianCalendar(day1.YEAR, day1.MONTH, day1.DAY_OF_MONTH + day);
          fullDates.add(aNewDay);
          }
       }
  </code></pre>
  
  <p>But, I'm pretty sure that this will not work at all. Imagine those parameters :</p>
  
  <blockquote>
    <p>2012/12/21 to 2013/02/14</p>
  </blockquote>
  
  <p>Not the same year, not the same month, It can't work properly. So, I scratched my head a little bit and decided to use the variable DAY_OF_YEAR.</p>
  
  <p>But, i'm still stuck because I don't know how I could manipulate this variable to create correct dates with good Months &amp; good Years..</p>