I'm wondering if there are any time formats in Joomla? I see JText::_('DATE_FORMAT_LC?')
.
Is there nothing comparable for times?
-
1Could 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?– LodderCommented Mar 23, 2016 at 20:17
-
@Lodder I want to format a time using the settings for the selected locale (language/country).– George SextonCommented Mar 24, 2016 at 1:56
Add a comment
|
2 Answers
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.
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: