2

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

  • 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 Mar 23 '16 at 20:17
  • @Lodder I want to format a time using the settings for the selected locale (language/country). – George Sexton Mar 24 '16 at 1:56
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.

| improve this answer | |
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:

| improve this answer | |

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.