3 declare(strict_types=1);
    40     public const UTC = 
'UTC';
    60         $this->log = $DIC->logger()->cal();
    63             $this->timezone = $a_timezone;
    65             $this->timezone = self::_getDefaultTimeZone();
    68         if (!self::$server_timezone) {
    69             self::$server_timezone = self::_getDefaultTimeZone();
    72         if (!self::$default_timezone) {
    73             self::_getDefaultTimeZone();
    79         return array(
'timezone');
    85         $this->log = $DIC->logger()->cal();
   100             $a_tz = self::_getDefaultTimeZone();
   103         $instance = self::$instances[$a_tz] ?? (self::$instances[$a_tz] = 
new ilTimeZone($a_tz));
   106         if (!array_key_exists($instance->getIdentifier(), self::$valid_tz)) {
   107             if (!$instance->validateTZ()) {
   110             self::$valid_tz[$instance->getIdentifier()] = 
true;
   123             self::_switchTimeZone($this->timezone);
   127             $this->log->warning(
': Unsupported timezone given: Timzone: ' . $this->timezone);
   138             self::_switchTimeZone(self::$default_timezone);
   142             $this->log->warning(
': Unsupported timezone given: Timzone: ' . $this->timezone);
   160         $logger = $DIC->logger()->cal();
   161         if (self::$current_timezone == $a_timezone) {
   166         if (function_exists(
'date_default_timezone_set')) {
   167             if (!date_default_timezone_set($a_timezone)) {
   168                 $logger->info(
'Invalid timezone given. Timezone: ' . $a_timezone);
   171             #$ilLog->write(__METHOD__.': Switched timezone to: '.$a_timezone);   172             self::$current_timezone = $a_timezone;
   175         if (!putenv(
'TZ=' . $a_timezone)) {
   176             $logger->warning(
'Cannot set TZ environment variable. Please register TZ in php.ini (safe_mode_allowed_env_vars). Timezone');
   179         self::$current_timezone = $a_timezone;
   186         if (!self::$server_timezone) {
   187             self::$server_timezone = self::_getDefaultTimeZone();
   189         self::$default_timezone = $a_tz;
   194         self::$default_timezone = self::$server_timezone;
   195         self::_switchTimeZone(self::$default_timezone);
   203         if (strlen(self::$default_timezone)) {
   204             return self::$default_timezone;
   208         if (function_exists(
'date_default_timezone_get') and $tz = date_default_timezone_get()) {
   209             return self::$default_timezone = $tz;
   212         if ($tz = ini_get(
'date.timezone')) {
   213             return self::$default_timezone = $tz;
   216         if ($tz = getenv(
'PHP_TZ')) {
   217             return self::$default_timezone = $tz;
   220         if ($tz = getenv(
'TZ')) {
   221             return self::$default_timezone = $tz;
   223         if (strlen($tz = date(
'T'))) {
   224             return self::$default_timezone = $tz;
   226         return self::$default_timezone = self::UTC;
   236             $tz = self::_getDefaultTimeZone();
   241         date_default_timezone_set($tz);
 
static _getDefaultTimeZone()
Calculate and set default time zone. 
 
static _getInstance(string $a_tz='')
get instance by timezone 
 
switchTZ()
Switch timezone to given timezone. 
 
static initDefaultTimeZone(ilIniFile $ini)
Initialize default timezone from system settings. 
 
restoreTZ()
Restore default timezone. 
 
static _restoreDefaultTimeZone()
 
static _setDefaultTimeZone(string $a_tz)
 
static string $default_timezone
 
Class for TimeZone exceptions. 
 
static string $current_timezone
 
readVariable(string $a_group, string $a_var_name)
reads a single variable from a group 
 
static _switchTimeZone(string $a_timezone)
 
static string $server_timezone
 
__construct(string $a_timezone)
Create new timezone object If no timezone is given, the default server timezone is chosen...