How to change Joomla K2 date format

By default K2 date format is display as days, date, month, year and time (Example Wednesday, 30 September 2015 02:53), if you want to shorten the displayed date it is quite easy to make the change.

Open item.php file (components/com_k2/templates/default/item.php). But it is not advised to over write any core file, instead you can overwrite the file within your template folder. To overwrite this file create a folder in your template folder like this - templates/YOUR_TEMPLATE_NAME/html/com_k2/templates/default/item.php

Open item.php > Go to Line 37 or search for below code

<span class="itemDateCreated">
    <?php echo JHTML::_('date', $this->item->created , JText::_('K2_DATE_FORMAT_LC2')); ?>

Change with this code

<span class="itemDateCreated">
    <?php echo JHTML::_('date', $this->item->created , JText::_('d M Y')); ?>

The changed code is 'K2_DATE_FORMAT_LC2' to 'd M Y'

In case if you don't know what is K2.

K2 is the ideal solution for managing your Joomla website content, regardless of website size. You can use it from a small blog website to a complex website. With the help of K2 you can transform your Joomla website to a news/magazine site with author blogs, product catalogs, work portfolio, knowledge base, download/document manager, directory listing and more, all this bundled under one package! And since K2 is extensible with additional fields to its base item form, you can easily create category-specific content types, e.g. article, blog post, product page, directory listing etc. It is free download for everyone.

Visit K2 site

Copyright © 2024 Siam Naulak.