public function Timezone::__construct in Geo Time Zone 7.2
Same name and namespace in other branches
- 8.3 src/Timezone.php \Drupal\geotimezone\Timezone::__construct()
- 8 src/Timezone.php \Drupal\geotimezone\Timezone::__construct()
- 8.2 src/Timezone.php \Drupal\geotimezone\Timezone::__construct()
- 6.2 src/Timezone.php \Drupal\geotimezone\Timezone::__construct()
- 6 src/Timezone.php \Drupal\geotimezone\Timezone::__construct()
- 7 src/Timezone.php \Drupal\geotimezone\Timezone::__construct()
Timezone constructor.
Parameters
int $index: Time zone list index.
File
- src/
Timezone.php, line 43 - Contains \Drupal\geotimezone\Timezone.
Class
- Timezone
- Holds the list of time zone identifiers and UTC/GMT offsets.
Namespace
Drupal\geotimezoneCode
public function __construct($index = 0) {
static::$list = $this
->loadList();
$this->identifier = static::$list[$index]['identifier'];
// Convert to time zone offset
$time = new \DateTime('now', new \DateTimeZone($this->identifier));
$this->offset = $time
->format('P');
//$this->offset = static::$list[$index]['offset'];
}