title: comparing date with mongoDB ISODate format in php
body: <p>I am having a field in mongoDB, say <code>birth_date</code> which is in ISODate format like </p>
  
  <pre><code>ISODate("2013-08-15T23:00:00Z")
  </code></pre>
  
  <p>In php, I am getting dates in the string format </p>
  
  <p><code>"2013-08-10"</code> </p>
  
  <p>I want all the data for which <code>birth_date</code> is greater than <code>2013-08-10</code> </p>
  
  <p>For this I have a code</p>
  
  <pre><code>$inputDate = "2013-08-10";
  $dateFilter = array("\$gte",$inputDate); //works well when birth_date field is normat date string like "2013-08-16" but doesn't work with ISODate format as above
  $dateRangeQuery = array("birth_date" =&gt; $dateFilter);
  </code></pre>
  
  <p>which generate the query <code>{"birth_date":{"$gte":"2013-08-10"}}</code> which is not correctly filtering data. </p>
  
  <p>Following code snippet too didn't work</p>
  
  <pre><code>$dateFilter = array("\$gte",date("c", $inputDate)); 
  </code></pre>
  
  <p>generates the query</p>
  
  <p><code>{"birth_date":{"$gte":"2013-08-10T00:00:00+05:30"}}</code></p>
  
  <p>then this too didn't work</p>
  
  <pre><code>$dateFilter = new MongoDate($inputDate)
  </code></pre>
  
  <p>generates query</p>
  
  <pre><code>{"birth_date":{"$gte":{"sec":2013,"usec":0}}}
  </code></pre>
  
  <p>Please suggest :)</p>