Convert JavaScript string to integer
<p>I have a date which is provided as a string such as 09/12/2012.</p>

<p>If the string is today, I wish to display "Today", else I wish to display 09/12/2012.</p>

<p>The problem with my approach shown below is that a month like 09 gets parsed to 0 and not 9.</p>

<p>What is the best way to do this? Thank you</p>

<pre><code>var currentDate = new Date();
dateText='09/12/2012';
var a=dateText.split('/');// mdY
$("#date").text(((parseInt(a[0])-1==currentDate.getMonth()&amp;&amp;parseInt(a[1])==currentDate.getDate()&amp;&amp;parseInt(a[2])==currentDate.getFullYear())?'Today':dateText));
</code></pre>
