title: Java: Iteration of given Dates
body: <p>I have two dates in Java:</p>
  
  <pre><code>Wed Jan 05 00:00:00 CET 2011
  Sat Jan 15 23:59:59 CET 2011
  </code></pre>
  
  <p>Now I want to iterate over them, so that every day I can do a <code>System.out.println()</code> in which I put the date in this kind on the console:</p>
  
  <pre><code>2011-01-05
  2011-01-06
  2011-01-07
  ...
  2011-01-13
  2011-01-14
  2011-01-15
  </code></pre>
  
  <p>How can I do this?</p>
  
  <p>Best Regards, Tim.</p>
  
  <p><strong>Update:</strong></p>
  
  <pre><code>Calendar calend = Calendar.getInstance();
  calend.setTime(myObject.getBeginDate());
  Calendar beginCalendar = new GregorianCalendar(calend.get(Calendar.YEAR), calend.get(Calendar.MONTH), calend.get(Calendar.DATE));
  calend.setTime(myObject.getEndDate());
  Calendar endCalendar = new GregorianCalendar(calend.get(Calendar.YEAR), calend.get(Calendar.MONTH), calend.get(Calendar.DATE));
  while (beginCalendar.compareTo(endCalendar) &lt;= 0) {
       // ... calculations
      beginCalendar.add(Calendar.DATE, 1);
  }
  </code></pre>