title: Using `date` command to get previous, current and next month
body: <p>I am using below to get previous, current and the next month under <code>Ubuntu</code> 11.04:</p>
  
  <pre><code>LAST_MONTH=`date +'%m' -d 'last month'`
  NEXT_MONTH=`date +'%m' -d 'next month'`
  THIS_MONTH=`date +'%m' -d 'now'`
  </code></pre>
  
  <p>It works well until today, the last day of October, 2012 (2012-10-31)</p>
  
  <p>I get below result as of now:</p>
  
  <pre><code>$ date
  Wed Oct 31 15:35:26 PDT 2012
  $ date +'%m' -d 'last month'
  10
  $ date +'%m' -d 'now'
  10
  $ $ date +'%m' -d 'next month'
  12
  </code></pre>
  
  <p>I suppose the outputs should be <code>9</code>,<code>10</code>,<code>11</code> respectively.</p>
  
  <p>Don't understand why <code>date</code> outputs behave like this. What should be a good way to get consistant <code>previous</code>, <code>current</code> and <code>next</code> month instead?</p>