title: How to get the difference in months between two dates in PHP
body: <p>I wanted to calculate the difference between two dates in month with PHP but it seems like there is a bug somewhere.</p>
  
  <pre><code>$datetime1 = new DateTime(date('Y-m-d'));
  $datetime2 = new DateTime(MyObject-&gt;getDate());
  echo($datetime1-&gt;format('d/m/Y'));
  echo($datetime2-&gt;format('d/m/Y));
  </code></pre>
  
  <p>Result:</p>
  
  <pre><code>29/01/2016
  27/01/2015
  
  $dateInterval = $datetime1-&gt;diff($datetime2);
  echo($dateInterval-&gt;format(%m months);
  </code></pre>
  
  <p>Result:</p>
  
  <pre><code>0 months
  </code></pre>
  
  <p>Why is that? What am i doing wrong ?</p>