title: Get date as a string from datetime object in doctrine 2
body: <p>In one of my entities, I have a protected property called <code>insert_date</code> which is a datetime.</p>
  
  <p>When I extract the data afterwards, I don't get the date as a string, I get an object. My var dump:</p>
  
  <pre><code>&lt;pre class='xdebug-var-dump' dir='ltr'&gt; &lt;b&gt;object&lt;/b&gt;(&lt;i&gt;DateTime&lt;/i&gt;)[&lt;i&gt;1560&lt;/i&gt;] &lt;i&gt;public&lt;/i&gt; 'date' &lt;font color='#888a85'&gt;=&amp;gt;&lt;/font&gt; &lt;small&gt;string&lt;/small&gt; &lt;font color='#cc0000'&gt;'2011-08-26 12:40:29'&lt;/font&gt; &lt;i&gt;(length=19)&lt;/i&gt; &lt;i&gt;public&lt;/i&gt; 'timezone_type' &lt;font color='#888a85'&gt;=&amp;gt;&lt;/font&gt; &lt;small&gt;int&lt;/small&gt; &lt;font color='#4e9a06'&gt;3&lt;/font&gt; &lt;i&gt;public&lt;/i&gt; 'timezone' &lt;font color='#888a85'&gt;=&amp;gt;&lt;/font&gt; &lt;small&gt;string&lt;/small&gt; &lt;font color='#cc0000'&gt;'Europe/London'&lt;/font&gt; &lt;i&gt;(length=13)&lt;/i&gt; &lt;/pre&gt;&lt;pre class='xdebug-var-dump' dir='ltr'&gt; &lt;b&gt;object&lt;/b&gt;(&lt;i&gt;DateTime&lt;/i&gt;)[&lt;i&gt;1571&lt;/i&gt;] &lt;i&gt;public&lt;/i&gt; 'date' &lt;font color='#888a85'&gt;=&amp;gt;&lt;/font&gt; &lt;small&gt;string&lt;/small&gt; &lt;font color='#cc0000'&gt;'2011-08-26 12:40:29'&lt;/font&gt; &lt;i&gt;(length=19)&lt;/i&gt; &lt;i&gt;public&lt;/i&gt; 'timezone_type' &lt;font color='#888a85'&gt;=&amp;gt;&lt;/font&gt; &lt;small&gt;int&lt;/small&gt; &lt;font color='#4e9a06'&gt;3&lt;/font&gt; &lt;i&gt;public&lt;/i&gt; 'timezone' &lt;font color='#888a85'&gt;=&amp;gt;&lt;/font&gt; &lt;small&gt;string&lt;/small&gt; &lt;font color='#cc0000'&gt;'Europe/London'&lt;/font&gt; &lt;i&gt;(length=13)&lt;/i&gt;
  </code></pre>
  
  <p>I tried:</p>
  
  <pre><code>foreach($dateObj as $date) {
  
  }
  </code></pre>
  
  <p>But it doesn't extract ...  How can I get the date property from this object? Even <code>$insert_date-&gt;date</code> doesn't work.</p>