1

我试图将我的 joomla 3.2 文章创建日期更改为显示为“自此创建”EX:创建于 2 小时前,创建于 2 周前。你能帮助我吗 ?

4

1 回答 1

1

您应该能够使用语言覆盖和 php 日期格式来做到这一点

https://stackoverflow.com/a/11728790/6096

$post_date = '13436714242'; // strtotime();
$now = time();

// will echo "2 hours ago" (at the time of this post)
echo timespan($post_date, $now) . ' ago';

所以对于 joomla 日期编辑你需要的模板覆盖

echo timespan( strtotime($this->item->publish_up, $now) ) . ' ago';
echo timespan( strtotime($this->item->modified, $now) ) . ' ago';
echo timespan( strtotime($this->item->created, $now) ) . ' ago';

因为您首先需要将日期转换回时间戳。我不认为只有一个地方可以做,所以你必须寻找几个。

于 2014-04-18T09:46:03.277 回答