Did he have birthday this month or not?
<pre><code>var monthDiff = today.getMonth() - pastdate.getMonth();
var hadBirthdayThisMonth = 
    (today.getMonth() &gt; pastdate.getMonth()) ?
        true : (today.getMonth() &lt; pastdate.getMonth()) ? 
            false : (today.getDate() &gt; pastdate.getDate()) ?
                true : (today.getDate() &lt; pastdate.getDate()) ? false : true;
if (!hadBirthdayThisMonth) monthDiff--;
</code></pre>

<p>From August 20th 2011 to September 19 2011, the number of days is 60 and it shows 2 months for me, but i want to show it <code>one</code> month until his birthday <code>Sept 20th</code> comes.</p>

<p>I came up with the above logic, but it does not work. </p>
