开发者

can't access php DateTime contents

开发者 https://www.devze.com 2023-03-25 23:30 出处:网络
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

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)

0

精彩评论

暂无评论...
验证码 换一张
取 消