I have this array value:
Array
(
[0] => DateTime Object
(
[date] => 2019-01-28 08:19:44
[timezone_type] => 3
[timezone] => Asia/Jakarta
)
)
And PHP:
for($i = 0; $i < $rowsintimespanAccept; $i++)
{
$a = array();
$a[] = DateTime::createFromFormat($createFromFormat, $linesAccept[$i]);
if(count(array_filter($a)) == count($a))
{
echo "<pre>";
print_r($a);
}
}
Now my question how to get [date]
value?
I tried using this code but got empty.
print_r($a['date']);
UPDATED
Now I have this array value:
DateTime Object
(
[date] => 2019-01-28 08:21:01
[timezone_type] => 3
[timezone] => Asia/Jakarta
)
DateTime Object
(
[date] => 2019-01-28 08:21:14
[timezone_type] => 3
[timezone] => Asia/Jakarta
)
DateTime Object
(
[date] => 2019-01-28 08:19:44
[timezone_type] => 3
[timezone] => Asia/Jakarta
)
and PHP:
for($i = $readRowAfter; $i < count($linesAccept); $i++)
{
$dateobjAccept = DateTime::createFromFormat($createFromFormat, $linesAccept[$i]);
if($dateobjAccept < $toDateTime && $dateobjAccept > $fromDateTime)
{
$rowsintimespanAccept++;
}
echo "<pre>";
print_r($dateobjAccept);
}
Tried using this:
print_r($dateobjAccept->format('Y-m-j H:i:s'));
But only got result: 2.