ValueObjects\DateTime\TimeZone::fromNativeDateTimeZone PHP Method

fromNativeDateTimeZone() public static method

Returns a new Time from a native PHP \DateTime
public static fromNativeDateTimeZone ( DateTimeZone $timezone ) : self
$timezone DateTimeZone
return self
    public static function fromNativeDateTimeZone(\DateTimeZone $timezone)
    {
        return static::fromNative($timezone->getName());
    }

Usage Example

Beispiel #1
0
 public function testFromNativeDateTimeZone()
 {
     $nativeTimeZone = new \DateTimeZone('Europe/Madrid');
     $timeZoneFromNative = TimeZone::fromNativeDateTimeZone($nativeTimeZone);
     $constructedTimeZone = new TimeZone(new StringLiteral('Europe/Madrid'));
     $this->assertTrue($timeZoneFromNative->sameValueAs($constructedTimeZone));
 }
All Usage Examples Of ValueObjects\DateTime\TimeZone::fromNativeDateTimeZone