title: Java Calendar/Date issue
body: <p>I'm building a list of Months I'm using as headers for a table in a JSP.</p>
  
  <p>What I’m doing is comparing what the month is I'm getting from the database and iterating or "trying" to all the way up to that month.  In the case, the Month is November</p>
  
  <p>The problem is I'm only able to build a list from October 2012 to October 2013</p>
  
  <p>My logic looks sound, I'm not sure what else I can try.</p>
  
  <p>Starting point and compare..From the database the key is </p>
  
  <pre><code>int effortYear = 2013
  Calendar max = Calendar.getInstance();
           max.set(effortYear,8,1,0,0,0);
     for (ItemUnitBean item:  scheduledBeans)
  
         {
               ItemUnitBean bean = new ItemUnitBean();
            for(Entry&lt;Date, ItemPhasing&gt; en : item.getScheduledItemByMonth().entrySet() )
             {
  System.out.println( "KEY= " + en.getKey() );  // KEY =2013-11-01 
    if ( en.getKey().compareTo(max.getTime()) &gt; 0 ) 
                {
                      max.setTime(en.getKey());
                }
  
             }
            finalScheduledBeans.add(bean);
         }
  </code></pre>
  
  <p>Now Building the list:</p>
  
  <pre><code>TreeSet&lt;Date&gt; scheduledMonthList = new TreeSet&lt;Date&gt;();
    Calendar temp = Calendar.getInstance();
           temp.set(effortYear-1,9,1,0,0,0);
  
           do 
           {
               scheduledMonthList.add(temp.getTime());
               System.out.println("montList= " + temp.getTime()  );
               temp.add( Calendar.MONTH, 1 );
  
  
           }  while( temp.compareTo(max) &lt;= 0 );
  </code></pre>
  
  <p>This is what the logger spits out:</p>
  
  <p><img src="https://i.stack.imgur.com/ifQmh.png" alt="enter image description here"></p>
  
  <p>Can anyone see why Nov is not being added to the list??</p>