/** * Get this users timezone * * @return \DateTimeZone */ public function getTimezone() { if (!is_object($this->_timezone)) { if ($this->_timezone == 'sys' || $this->_timezone == null) { $this->_timezone = framework\Settings::getServerTimezone(); } else { $this->_timezone = new \DateTimeZone($this->_timezone); } } return $this->_timezone; }
function tbg_get_timezone_offset($skipusertimestamp = false) { // offset the timestamp properly if (!$skipusertimestamp) { $tz = \thebuggenie\core\framework\Context::getUser()->getTimezone(); $tstamp = $tz->getOffset(new DateTime(null, \thebuggenie\core\framework\Settings::getServerTimezone())); } else { $tstamp = \thebuggenie\core\framework\Settings::getServerTimezone()->getOffset(new DateTime('GMT')); } return $tstamp; }