我在自己制作的自定义组件中编写了如下代码:
$date = date('m/d/Y h:i:s a', time())."<br>";
echo 'Current date and time is: ' . $date;
$date = JFactory::getDate();
echo 'Current date and time is: ' . $date->toFormat() ."<br>";
第一段代码正确地显示了日期时间,但第二段代码显示的是比实际时间晚三个小时。我已检查configuration.php文件中public $offset = 'Europe/Athens'是否正确。我还尝试从系统配置菜单更改设置,但似乎都不能修复JFactory::getDate()显示错误时间的问题。我错过了什么?