title: Generating all days between 2 given dates in Java
body: <p>I'm trying to get an array of Dates, while my input is a 'from'/'to' structure. 
  So my input is:</p>
  
  <pre><code>String date1 = "2014-01-01";
  String date2 = "2014-05-01";
  </code></pre>
  
  <p>My output should be an Arraylist with all dates between date1 and date2. 
  I've already looked for this, but I could only find questions about the difference between 2 dates:</p>
  
  <pre><code>SimpleDateFormat myFormat = new SimpleDateFormat("dd MM yyyy");
  String inputString1 = "23 01 1997";
  String inputString2 = "27 04 1997";
  
  try {
      Date date1 = myFormat.parse(inputString1);
      Date date2 = myFormat.parse(inputString2);
      long diff = date2.getTime() - date1.getTime();
      System.out.println ("Days: " + TimeUnit.DAYS.convert(diff,TimeUnit.MILLISECONDS));
  } catch (ParseException e) {
  e.printStackTrace();
  }
  </code></pre>
  
  <p>Any hints or suggestions? All other questions are for iOS or SQL.</p>