title: How to query by time in MongoDB with PHP?
body: <p>I want to query a collection and get documents which have created less than 3 hours ago.</p>
  
  <pre><code>$realtime = date("Y-m-d H:i:s");
  $mongotime = New Mongodate(strtotime($realtime));
  
  $mongotime = $mongotime - 3 hours; //PSEUDOCODE
  $some_condition = array('time' =&gt; array('$lt'=&gt;$mongotime) );
  
  $result = $db-&gt;collection-&gt;find( $some_condition );
  </code></pre>
  
  <p>Is there an effective way to put </p>
  
  <blockquote>
    <p>$some_condition </p>
  </blockquote>
  
  <p>part without using IF statement in PHP?</p>