can't access php DateTime contents
I've got a variable that upon var_dump
prints this.
It contains a date, but I just don't know how to access the date data, if I put
$myVariable[date]
OR $myVariable["date"]
OR $myVariable['date']
all result in error.
object(Dat开发者_运维知识库eTime)#8 (3) {
["date"]=> string(19) "2011-07-25 00:00:00"
["timezone_type"]=> int(3)
["timezone"]=> string(16) "Europe/Stockholm"
}
I don't understand what the first number is either, the #8
right after the (DateTime)
...
echo $myVariable->format('Y-m-d H:i:s');
(thanks to kmfk for that answer)
精彩评论