ValueObjects\DateTime\TimeZone::toNativeDateTimeZone PHP Method

toNativeDateTimeZone() public method

Returns a native PHP \DateTimeZone version of the current TimeZone.
public toNativeDateTimeZone ( ) : DateTimeZone
return DateTimeZone
    public function toNativeDateTimeZone()
    {
        return new \DateTimeZone($this->getName()->toNative());
    }

Usage Example

Beispiel #1
0
 public function testToNativeDateTimeZone()
 {
     $nativeTimeZone = new \DateTimeZone('Europe/Madrid');
     $timeZone = new TimeZone(new StringLiteral('Europe/Madrid'));
     $this->assertEquals($nativeTimeZone, $timeZone->toNativeDateTimeZone());
 }