object(DateTime)#268 (3) {
["date"]=>
string(19) "2010-02-02 00:00:00"
["timezone_type"]=>
int(3)
["timezone"]=>
string(13) "Europe/Berlin"
}
how to access the key "date" from the above, Thank you
object(DateTime)#268 (3) {
["date"]=>
string(19) "2010-02-02 00:00:00"
["timezone_type"]=>
int(3)
["timezone"]=>
string(13) "Europe/Berlin"
}
how to access the key "date" from the above, Thank you
You can access the date value in two different ways.
Number one: Use __toString()
echo $var->__toString();
// or
echo (string)$var;
Number two: Use the DateTime format method:
echo $var->format('Y-m-d H:i:s');