Changing the date created format on Joomla articles

Rate this topic: Evaluations: 1, 1.00 on the average.Evaluations: 1, 1.00 on the average.Evaluations: 1, 1.00 on the average.Evaluations: 1, 1.00 on the average.Evaluations: 1, 1.00 on the average.Evaluations: 1, 1.00 on the average.1.00 out of 6 based on 1 vote(s)
GK User
Thu Jun 11, 2015 9:31 am
Reply with quote
Report this post
Hi,
Can you tell me the best way to go about changing the date format on articles. Currently the template only displays the day and month e.g. 10 May, I'd like to add the year.
Thanks
Ken
User avatar
Expert Boarder

GK User
Sat Jun 13, 2015 10:08 am
Reply with quote
Report this post
Hi,
if we talk about default articles you have to edit that file: templates\gk_musicstate\html\com_content\article\default.php
if about K2 items, this one: gk_musicstate\html\com_k2\templates\default\item.php

find area where you will find date, this is simple php code, no magic.
User avatar
Platinum Boarder

GK User
Mon Jun 15, 2015 1:30 pm
Reply with quote
Report this post
Thanks, I don't suppose you could give me a bit of help with the editing, I'm guessing when it comes to PHP, but I think this is the relevant bit:

Code: Select all
<?php elseif ($params->get('show_create_date')) : ?>
         <li class="created"><time datetime="<?php echo JHtml::_('date', $this->item->created, JText::_(DATE_W3C)); ?>"  itemprop="dateCreated"><?php echo JHtml::_('date', $this->item->created, JText::_('F j, Y')); ?></time></li>
         <?php endif; ?>


I'd assume (obvs incorrectly) that JText::_('F j, Y')) would give the full month and day, then year e.g June 11, 2015 but all I'm getting is June 11.

Here's what I've got in the HTML:
Code: Select all
<time datetime="2015-06-11T14:21:12+00:00">June 11</time>


Thanks for the help!

Ken
User avatar
Expert Boarder

GK User
Fri Jun 19, 2015 6:53 am
Reply with quote
Report this post
You have to add "Y" before comma.
item->publish_up, JText::_('j F Y')); ?>
User avatar
Platinum Boarder


cron