title: Unable to access values from object
body: <p>I am trying to get the date and time from this object:
  <code>Recurr\RecurrenceCollection Object ( [elements:Doctrine\Common\Collections\ArrayCollection:private] =&gt; Array ( [0] =&gt; Recurr\Recurrence Object ( [start:protected] =&gt; DateTime Object ( [date] =&gt; 2018-01-24 01:00:00.000000 [timezone_type] =&gt; 3 [timezone] =&gt; UTC ) [end:protected] =&gt; DateTime Object ( [date] =&gt; 2018-01-24 01:00:00.000000 [timezone_type] =&gt; 3 [timezone] =&gt; UTC ) [index:protected] =&gt; 1 ) ) )</code></p>
  
  <p>I have reached to dateTime object using:</p>
  
  <pre><code>foreach($events as $event){
              $event=(array)$event;
              foreach($event as $key=&gt;$value){
                  echo $key.'&lt;br&gt;';
                  //echo date_format(new DateTime($value),'F d,Y');
                  //echo $value-&gt;format('Y-m-d H:i:s');
              }
              print_r($event);
          }
  </code></pre>
  
  <p>But now if I try to use: <code>echo $value-&gt;format('Y-m-d H:i:s');</code>
  It says: <code>Call to a member function format() on integer</code></p>
  
  <p>I don't know what I am doing wrong. I have read almost 100 posts here on Stack Overflow but nothing has helped. Please if someone can help me out with this.</p>
  
  <p>What I need is: Date and Time from that DateTime Object.</p>