I have a function on a php page that is intended to grab the creation date/time of video files using getid3. I thought everything had been working fine and was ready to put this version to bed when I was (of course) running everything one more time to make sure and ended up with an issue I just can't seem to figure out.
The relevant bit of code is this:
$getID3 = new getID3;
$ThisFileInfo = $getID3->analyze($file);
if ($ThisFileInfo["quicktime"]["moov"]["subatoms"][0]["creation_time_unix"]){
$createdate = new DateTime("@".strval($ThisFileInfo["quicktime"]["moov"]["subatoms"][0]["creation_time_unix"]));
}
else {
$createdate = new DateTime("@".strval($ThisFileInfo["quicktime"]["moov"]["subatoms"][0]["modify_time_unix"]));
}
$createdate->setTimeZone(new DateTimeZone('America/New_York'));
//var_dump($createdate);
$createdate = $createdate->date;
When I process a file using this portion I get an error stating Notice: Undefined property: DateTime::$date in … line 179
(file path removed by me). However, I know that this isn't the case because if I uncomment the var_dump
line listed above I get the output object(DateTime)#3 (3) { ["date"]=> string(26) "2016-01-24 15:20:32.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "America/New_York" }
.
It certainly looks to me like the DateTime object $createdate
has a property called $date
, so I'm not sure what's going on, though I'm assuming it's something in my syntax. Can someone help me to sort this out?