Joomla Change Date Format String With PHP

We usually format Joomla date through Language overrides but some time we want to do it inside a specific override and have a unique format, so we can use the code below to do it:

// Instead of the plain code:
<?php echo $item->displayDate; ?>

// We use this code with PHP formating capability:
<?php 
echo JHtml::_('date', $item->displayDate, 'j M Y');
?>

You can change the ‘j M Y’ by using the PHP Date Format Manual to meet your needs.

Scroll to Top