Using Modx evo, I am trying to use the following snippet to display the date difference between published date and current date (in days), but getting weird output. What am I doing wrong?
<?php
$date2=$modx->documentObject['createdon'];
$date1=time();
$dateDiff = $date1 - $date2;
$daysOld = floor($dateDiff/(60*60*24));
return $daysOld;
?>
return print_r($modx->documentObject['createdon'],1);
and then ask again. – Vasis$daysOld = round($dateDiff/(60*60*24));
? – Vasis