Reputation: 870
Does anybody know how to get the system timezone offset in Joomla 3.1? I've tried the following:
return JFactory::getConfig()->getValue('offset');
but this results in the following error:
Fatal error: Call to undefined method JRegistry::getValue()
Thanks for any info pointing me in the right direction ....
Upvotes: 1
Views: 3822
Reputation: 633
Try:
$timezone = new DateTimeZone(JFactory::getConfig()->get('offset'));
$offset = $timezone->getOffset(new DateTime)/3600;
Upvotes: 0
Reputation: 7521
Try this:
$config = JFactory::getConfig();
$offset = $config->get('offset');
Upvotes: 3