Javascript date string picking up incorrect month
<p>I have a date like this: </p>

<blockquote>
  <p>Wed Apr 06 2016 12:21:07 GMT+0530 (India Standard Time)</p>
</blockquote>

<p>I need the month out of this date. My code is:</p>

<pre><code>dateText= "Wed Apr 06 2016 12:21:07 GMT+0530 (India Standard Time)"
var x = new Date(dateText);
var y = x.getMonth();
console.log(y)
</code></pre>

<p>the value of y comes out to be 3. But ideally, it should ve been 4 (since the month is April). The alternative I have thought of is to split the dateText by space i.e. </p>

<pre><code>arrDate = dateText.toString.split(" ");) 
</code></pre>

<p>and then extract the month from arrDate array. </p>

<p><strong><em>Can anyone tell my why javascript is showing '3' instead of '4' in my first code above?</em></strong></p>