title: Javascript Date, last day of the month parse issue
body: <p>I have seen a few posts about this, but none that I have learnt from.</p>
  
  <p>I need to send a certain date-timestamp to REST API, and it needs to look like this:</p>
  
  <p>2014-01-17 00:00:00.000</p>
  
  <p>So I need two, one for the current months first day, and the current months last day, so something like this:</p>
  
  <p>2014-02-01 00:00:00.000</p>
  
  <p>2014-02-28 00:00:00.000</p>
  
  <p>I have used the following code:</p>
  
  <pre><code>var date = new Date(),
      y = date.getFullYear(),
      m = date.getMonth(),
      firstDay = new Date(y, m, 1),
      lastDay = new Date(y, m + 1, 0),
      querydate = '"_createdAt" : {"$gt" : "' +
          y + '-' + m + '-' + firstDay + ' 00:00:00.000" , "$lt" : "' +
          y + '-' + m + '-' + lastDay + ' 00:00:00.000"}';
  </code></pre>
  
  <p>But this is the output I get, via dev mode on the browser:  </p>
  
  <pre><code>"_createdAt" : {"$gt" : "2014-1-Sat Feb 01 2014 00:00:00 GMT+0000 (GMT) 00:00:00.000" , "$lt" : "2014-1-Fri Feb 28 2014 00:00:00 GMT+0000 (GMT) 00:00:00.000"}}
  </code></pre>
  
  <p>As you can see, its giving me the correct year, but the month needs to be two digits, and for the last and first day, its giving the full date.</p>
  
  <p>Any ideas how I could manage this ?</p>