【发布时间】:2013-09-26 20:51:27
【问题描述】:
有人知道如何在 Joomla 3.1 中获取系统时区偏移量吗?我尝试了以下方法:
return JFactory::getConfig()->getValue('offset');
但这会导致以下错误:
Fatal error: Call to undefined method JRegistry::getValue()
感谢您为我指明正确方向的任何信息......
【问题讨论】:
有人知道如何在 Joomla 3.1 中获取系统时区偏移量吗?我尝试了以下方法:
return JFactory::getConfig()->getValue('offset');
但这会导致以下错误:
Fatal error: Call to undefined method JRegistry::getValue()
感谢您为我指明正确方向的任何信息......
【问题讨论】:
试试这个:
$config = JFactory::getConfig();
$offset = $config->get('offset');
【讨论】:
试试:
$timezone = new DateTimeZone(JFactory::getConfig()->get('offset'));
$offset = $timezone->getOffset(new DateTime)/3600;
【讨论】: