4

I would like to change the backend Joomla 3.0 date format for a custom component. Right now the component is taking the Joomla date backend format which is Y-m-d and that I need to change to d-m-Y for the custom component. I couldn't find where to change that format.

But one thing I found that the component date format code is coming from the following code:

<?php echo $item->date; ?>

And I would like to show the date in the following format:

echo date_format($date, 'd-m-Y H:i:s');

But don't know how I am going to implement it with the Joomla code. Need an idea on this.

6

You can set the date using JHtml as shown below:

<?php echo JHtml::_('date', $item->date, 'd-m-Y H:i:s'); ?>

So all you need to do is replace <?php echo $item->date; ?> with the above code

1

You can use pre formated strings and change in language files ex.: /language/en-GB/en-GB.ini

DATE_FORMAT_LC="l, d F Y"

DATE_FORMAT_LC1="l, d F Y"

DATE_FORMAT_LC2="l, d F Y H:i"

DATE_FORMAT_LC3="d F Y"

DATE_FORMAT_LC4="d.m.y"

DATE_FORMAT_JS1="d-m-y"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.