title: oracle add_months function differs from Java
body: <p>I recently discovered a difference between Oracle adds months to a given date (using ADD_MONTHS function) and the way Java adds months to a Calendar object.</p>
  
  <p>For instance in oracle: </p>
  
  <pre><code>select add_months('2009-02-28', +1) from dual;
  </code></pre>
  
  <p>produced the result: "09-03-31"</p>
  
  <p>And the query:</p>
  
  <pre><code>select add_months('2009-02-28', -1) from dual;
  </code></pre>
  
  <p>Produces the result "09-01-31"</p>
  
  <p>However in Java, the results of the same calculations (using GregorianCalendar.add() method) are (respectively):
  09-03-28
  and
  09-01-28</p>
  
  <p>Is there some way to make Oracle and Java behave the same? (e.g. some setting in oracle or some parameter in Java)?</p>