Resolved! This is a working php code to compare current date to article created date:
$date1 = new DateTime(); $date2 = new DateTime($article->created); if ($date1 > $date2)
echo $date1->format("Y-m-d") . " is latest than "
. $date2->format("Y-m-d"); else echo $date1->format("Y-m-d") . " is older than "
I'll assume you're using an inline script inside a PHP file.
Depending on how you're fetching the creation date of the article, you may need to make some minor modifications:
// Get the creation date of the article
// This may need to be changed according to your requirements
$creationDate = $this->item->created;