Comparing published date in Joomla K2 for New Icon
I am trying to automate the process of adding a css New icon next to my K2 article within the first 3 days of the published date. So here's what I came up with in com_k2\template\category_item.php 

        $newdate = time($this->item->publish_up) + 86400;
        $nowdate = time();
        <?php echo $nowdate <= $newdate?' item-new':'' ?>

The first line will get the published date of the article and add 3 days to it. The 2nd line would then grab the current server time. Then the 3rd line would compare the two date and echo item-new if the current time is still within 3 days from the published date.

The code did not generate any error msg, but the comparing of the two date doesn't seems to work because the New icon display on every article.

Could someone kindly point me in the right direction? I'm not good with php and most of that coding was inferred from other code. My guess is that the variables were defined properly but I cannot simply compare two dates with smaller or equal to?


Comparing published date in Joomla K2 for New Icon
===

I am trying to automate the process of adding a css New icon next to my K2 article within the first 3 days of the published date. So here's what I came up with in com_k2\template\category_item.php 

        $newdate = time($this->item->publish_up) + 86400;
        $nowdate = time();
        <?php echo $nowdate <= $newdate?' item-new':'' ?>

The first line will get the published date of the article and add 3 days to it. The 2nd line would then grab the current server time. Then the 3rd line would compare the two date and echo item-new if the current time is still within 3 days from the published date.

The code did not generate any error msg, but the comparing of the two date doesn't seems to work because the New icon display on every article.

Could someone kindly point me in the right direction? I'm not good with php and most of that coding was inferred from other code. My guess is that the variables were defined properly but I cannot simply compare two dates with smaller or equal to?

