Answer the question
In order to leave comments, you need to log in
How to change date format in Joomla?
The date in the database is written in the format 2016-12-05.
And on the site you need to display as 12/05/2016, that is, rearrange everything in places and through a dot.
The array is retrieved from the base:
<?php
defined('_JEXEC') or die;
class mod_remont_comments_helper
{
public static function get_remont_comments()
{
$db = JFactory::getDbo();
$query = 'SELECT * FROM #__remontel_comment';
$db->setQuery($query);
$remont_comments = $db->loadObjectList();
return $remont_comments;
}
}
<?php foreach ($remont_comments as $remont_comment): ?>
<li class="reviews__item">
<div class="reviews__block">
<i><?php echo $remont_comment->date ?></i>
</div>
</li>
<?php endforeach; ?>
Answer the question
In order to leave comments, you need to log in
echo implode(".", array_reverse(explode("-", $remont_comment->date)));
или
echo date("d.m.Y", strtotime($remont_comment->date));
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question