I'm creating a datetime object with:
$datetime = date_create_from_format('Y-m-d\TH:i:sP', $string);
Which gives an object with properties date
, timezone_type
, and timezone
. But I can't access any of these properties:
return $datetime->date;
This returns null
. What am I doing wrong?
Edit:
var_dump($datetime) gives:
object(DateTime)#807 (3) {
["date"]=>
string(19) "2015-04-14 13:28:06"
["timezone_type"]=>
int(1)
["timezone"]=>
string(6) "+00:00"
}