title: JavaScript Calc Year and Month between 2 Dates
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/41948/how-do-i-get-the-difference-between-two-dates-in-javascript">How do I get the difference between two Dates in JavaScript?</a>  </p>
  </blockquote>
  
  
  
  <p>I wanted to know how javascript can count the years and months between two dates. So for example between 26/10/2012 and 26/11/2013, there are 1 year and 1 month</p>
  
  <p>I have tried it so but it is wrong :(</p>
  
  <pre><code>var diff =  (new Date(y, m - 1, d).getTime(2011,(11-1),26) - new Date(2012, (11-1), 26).getTime()) / 1000 / 60 / 60 / 24 / 30;
  </code></pre>