2

I'm wondering if there are any time formats in Joomla? I see JText::_('DATE_FORMAT_LC?').
Is there nothing comparable for times?

2
  • 1
    Could you expand a little on what you're trying to achieve? Do you have a date which you're trying to format into something else for example?
    – Lodder
    Commented Mar 23, 2016 at 20:17
  • @Lodder I want to format a time using the settings for the selected locale (language/country). Commented Mar 24, 2016 at 1:56

2 Answers 2

1

You can find different formats in yoursite/language/en-GB/en-GB.ini
something like this:

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="Y-m-d"
DATE_FORMAT_JS1="y-m-d"

Regards.

1

In your code you could use something like this:

$date = JFactory::getDate();    
echo $date->calendar('j F Y', false, true);

With the calendar method you can use the PHP date format characters to format accordingly.

Other option:

JFactory::getDate()->format('%a %d %b %Y - %H:%M');

Read more:

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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