如何将 joomla 的日期格式更改为 d/m/Y?
how can i change date format for joomla to d/m/Y?
经过几次这样的尝试,我尝试更改 Joomla 3 DB 的日期格式table
echo date_format("end_date", "%d/%m/%Y");
echo $result->format('$result->end_date', 'd-m-Y');
// also tried to get kind of result March 10, 2001, 5:16 pm
echo date_format("end_date", "F j, Y, g:i a");
echo date_format("$result->end_date", "F j, Y, g:i a");
echo date_format('$result->end_date', 'F j, Y, g:i a');
echo date_format({$result->end_date}, 'F j, Y, g:i a');
echo date($result->end_date}, 'F j, Y, g:i a');
echo date('$result->end_date', 'F j, Y, g:i a');
echo "<time datetime='$result->end_date'>" "</time>";
,检查了 stack overflow 上的所有相关帖子是否有类似类型的代码、所有课程和示例,但无法将此 end_date 格式更改为 d/m/Y
<?php
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$select = array(
$db->quoteName('title'),
$db->quoteName('id'),
$db->quoteName('start_date'),
$db->quoteName('end_date')
);
$query->select(array($select));
$query->from($db->quoteName('#__rbid_auctions'));
$query->order($db->quoteName('id') . " DESC");
$query->setLimit(3);
$db->setQuery($query);
$results = $db->loadObjectList();
// display the results
foreach ( $results as $result) {
echo "<a href=\"index.php?option=com_rbids&task=viewbids&id={$result->id}\">{$result->title} . </a>";
echo "<p>" . $result->start_date . "</p>";
echo "<p>" . $result->end_date . "</p>";
}
?>
提前致谢
尝试使用以下方法:
// instantiate a new Joomla Date Object
$date = new JDate($result->start_date);
// echo the formatted date
echo $date->format('F j, Y, g:i a');
希望对您有所帮助,
杰斯
经过几次这样的尝试,我尝试更改 Joomla 3 DB 的日期格式table
echo date_format("end_date", "%d/%m/%Y");
echo $result->format('$result->end_date', 'd-m-Y');
// also tried to get kind of result March 10, 2001, 5:16 pm
echo date_format("end_date", "F j, Y, g:i a");
echo date_format("$result->end_date", "F j, Y, g:i a");
echo date_format('$result->end_date', 'F j, Y, g:i a');
echo date_format({$result->end_date}, 'F j, Y, g:i a');
echo date($result->end_date}, 'F j, Y, g:i a');
echo date('$result->end_date', 'F j, Y, g:i a');
echo "<time datetime='$result->end_date'>" "</time>";
,检查了 stack overflow 上的所有相关帖子是否有类似类型的代码、所有课程和示例,但无法将此 end_date 格式更改为 d/m/Y
<?php
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$select = array(
$db->quoteName('title'),
$db->quoteName('id'),
$db->quoteName('start_date'),
$db->quoteName('end_date')
);
$query->select(array($select));
$query->from($db->quoteName('#__rbid_auctions'));
$query->order($db->quoteName('id') . " DESC");
$query->setLimit(3);
$db->setQuery($query);
$results = $db->loadObjectList();
// display the results
foreach ( $results as $result) {
echo "<a href=\"index.php?option=com_rbids&task=viewbids&id={$result->id}\">{$result->title} . </a>";
echo "<p>" . $result->start_date . "</p>";
echo "<p>" . $result->end_date . "</p>";
}
?>
提前致谢
尝试使用以下方法:
// instantiate a new Joomla Date Object
$date = new JDate($result->start_date);
// echo the formatted date
echo $date->format('F j, Y, g:i a');
希望对您有所帮助,
杰斯