В одном из моих объектов у меня есть защищенное свойство с именем insert_date
, которое является датой и временем.
Когда я извлекаю данные впоследствии, я не получаю дату в виде строки, я получаю объект. Мой вар дамп:
<code><pre class='xdebug-var-dump' dir='ltr'> <b>object</b>(<i>DateTime</i>)[<i>1560</i>] <i>public</i> 'date' <font color='#888a85'>=></font> <small>string</small> <font color='#cc0000'>'2011-08-26 12:40:29'</font> <i>(length=19)</i> <i>public</i> 'timezone_type' <font color='#888a85'>=></font> <small>int</small> <font color='#4e9a06'>3</font> <i>public</i> 'timezone' <font color='#888a85'>=></font> <small>string</small> <font color='#cc0000'>'Europe/London'</font> <i>(length=13)</i>
object ( DateTime ) [ 1571 ] public 'date' = & gt;
string '2011-08-26 12: 40: 29' (длина = 19) public 'timezone_type'
= & gt; int 3 public ' timezone '
= & gt; string ' Европа / London ' (длина = 13)
Я пытался:
foreach($dateObj as $date) {
}
Но он не извлекается ... Как я могу получить свойство date из этого объекта? Даже $insert_date->date
не работает.