title: MySQL: date difference in months (even if 'month' < 30 days should be count as 1)
body: <p>I would like to compare 2 dates: '2012-05-05', '2012-06-04' and receive 1 as a result (difference bettwen May and June).</p>
  
  <p>What I got:</p>
  
  <pre><code>SELECT TIMESTAMPDIFF(MONTH, '2012-05-05', '2012-06-04') as difference
  -- output: 0
  </code></pre>
  
  <p>I'm looking for a query for which I will receive <strong>1</strong> as a result (dates are from 2 different months; not important if difference is in fact &lt; 30 days). </p>
  
  <p>I've tried:</p>
  
  <pre><code>SELECT TIMESTAMPDIFF(MONTH, DATE_FORMAT('2012-05-05','%Y-%m'), DATE_FORMAT('2012-06-04','%Y-%m') ) as difference
  -- output: NULL
  </code></pre>
  
  <p>also:</p>
  
  <pre><code>SELECT DATEDIFF( DATE_FORMAT('2012-05-05','%Y-%m'), DATE_FORMAT('2012-06-04','%Y-%m') ) as difference
  -- output: NULL
  </code></pre>
  
  <p>Do you have other ideas?</p>