title: MongoDB Date and ISODate Parsing
body: <p><strong>Question</strong>
  When parsing string as dates in MongoDB what is recommended implementation? </p>
  
  <p>I ask this because we have vendors sending us the string representation of a date in the format of "2017-01-01" and "2017/01/01". I would have thought that the parsing of those different strings would return the same result in MongoDB using the Date() and ISODate(). </p>
  
  <p>Given the following examples running through MongoChef against MongoDB 3.4</p>
  
  <pre><code>1. print(new Date("2016-01-01"))
  2. print(new Date("2016/01/01"))
  3. print(new ISODate("2016-01-01"))
  4. print(new ISODate("2016/01/01"))
  </code></pre>
  
  <p>Produces the following Results</p>
  
  <pre><code>1. Thu Dec 31 2015 18:00:00 GMT-0600 (Central Standard Time)
  2. Fri Jan 01 2016 00:00:00 GMT-0600 (Central Standard Time)
  3. Thu Dec 31 2015 18:00:00 GMT-0600 (Central Standard Time)
  4. 2017-01-06T10:34:01.814-0600 E QUERY    [thread1] Error: invalid ISO date
  </code></pre>
  
  <p>This does not make any sense to me. Anyone that could explain this to me would be much appreciated.</p>
  
  <p>The one that is acceptable for me is option #2 so I ensure that our dates are all separated by "/" and are using the new Date() constructor. </p>