Question

i make an API call for Podio, to get active space members. One of the fields that returns is last_seen_on, which is a DateTime Object.

When i print_r() it looks like:

DateTime Object
(
    [date] => 2013-11-02 22:47:09
    [timezone_type] => 3
    [timezone] => UTC
)

The issue is when I get the date or timezone_type or timezone by doing $object[date], or $object->date it throws an error.

Now i am not sure if this has something to do with php DateTime class, if so.. how do I use that object with that class?

Était-ce utile?

La solution

As it's a datetime instance, you can return the date with the following. Or however you want, in accordance to the documentation.

echo $object->format('Y-m-d H:i:s');

Link to documentation

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top