title: Calendar - Get last day of previous month
body: <p>I want to get the last day of the previous month.
  But this doesnt seem to work:</p>
  
  <pre><code>Calendar cal = Calendar.getInstance();
  Integer lastDay = cal.getInstance().getActualMaximum(cal.DAY_OF_MONTH);
  
  cal.add(Calendar.MONTH, -1);
  
  Integer prevMonth = cal.get(Calendar.MONTH);
  Integer prevMonthYear = cal.get(Calendar.YEAR);
  Integer lastDayPrevMonth = cal.getInstance().getActualMaximum(cal.DAY_OF_MONTH);
  
  System.out.println("Previous month was: " + prevMonth + "-" + prevMonthYear);
  System.out.println("Last day in previous month was: " + lastDayPrevMonth);
  System.out.println("Last day in this month is: " + lastDay);
  </code></pre>
  
  <p>This outputs:</p>
  
  <pre><code>I/System.out﹕: Previous month was 10-2015
  I/System.out﹕: Last day in previous month was 31
  I/System.out﹕: Last day in this month is 31
  </code></pre>
  
  <p>So it's getting the previous month, that's november (10), giving that it is now december (11).
  Last day in this month is also correct, but clearly, last day in previous month was not 31, but 30.</p>
  
  <p>Why does the second <code>getActualMaximum</code> give the same "last-day-in-month" as the first, when I do the add -1 thing?</p>