blob: 4bb57f22848cb956171066ad2068f4652506c3e6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
<?php
class TimezoneDTO {
public $Label;
public $Name;
public $Offset;
public $OffsetHours;
public $OffsetMinutes;
public function __construct($name) {
$tz = new DateTimeZone($name);
$this->Name = $tz->getName();
$this->Offset = $tz->getOffset(new DateTime());
$this->OffsetHours = $this->Offset / 3600;
$this->OffsetMinutes = $this->Offset % 3600 / 60;
$this->Label = sprintf('UTC%+03d:%02d %s', $this->OffsetHours, $this->OffsetMinutes, $this->Name);
}
}
?>
|