I have a JSON obtained from an API that returns a list of events like this:
Array
(
[alertList] => Array
(
[alerts] => Array
(
[0] => Array
(
[id] => 145392039
[name] => Failed Zonetransfer
[type] => Failed Zonetransfer (Critical)
[startDate] => Aug 22, 2016 10:24 AM
[errorString] =>
)
)
[errorString] =>
)
)
I use strtotime
at index startDate
to format it for timestamp.
How can I check if the event is today?
I thought about comparing with the current day, taking the timestamp at 00:00, but it did not work:
$date = new DateTime();
//$date->add(new DateInterval('PT1D')); essa linha tem erro, o parametro creio eu
$timestamp = ($date->getTimestamp()*1000);
echo $timestamp.PHP_EOL;exit;