title: Mongodate convert
body: <p>After executing the query</p>
  
  <pre><code>$orders = Orders::connection()-&gt;connection-&gt;command(array(
    'aggregate' =&gt; 'orders',
    'pipeline' =&gt; array( 
      array( 
        '$group' =&gt; array( 
          '_id' =&gt; array('cust_id'=&gt;'$cust_id','ord_date'=&gt;'$ord_date'),
        'total' =&gt; array( '$sum' =&gt; '$price') ,
          ),
        ),
      )
  ));     
  </code></pre>
  
  <p>I get the output array of $orders as </p>
  
  <pre><code>Array
  (
      [0] =&gt; Array
          (
              [_id] =&gt; Array
                  (
                      [cust_id] =&gt; xyz123
                      [ord_date] =&gt; MongoDate Object
                          (
                              [sec] =&gt; 1351875851
                              [usec] =&gt; 102000
                          )
  
                  )
  
              [total] =&gt; 75
          )
  
      [1] =&gt; Array
          (
              [_id] =&gt; Array
                  (
                      [cust_id] =&gt; abc123
                      [ord_date] =&gt; MongoDate Object
                          (
                              [sec] =&gt; 1351875851
                              [usec] =&gt; 102000
                          )
  
                  )
  
              [total] =&gt; 125
          )
  
  )
  </code></pre>
  
  <p>I have tried the following with MongoDate object to print it correctly</p>
  
  <pre><code>foreach($orders['result'] as $o){
      $date = $o['ord_date'];
      echo date('Y-M-d',$date-&gt;sec);
  }
  </code></pre>
  
  <p>Also tried</p>
  
  <pre><code>foreach($orders['result'] as $o){
      $date = new MongoDate ($o['ord_date']);
      echo date('Y-M-d',$date-&gt;sec);
  }
  </code></pre>
  
  <p>Can some one show me the correct method to do so?</p>