fromNative() public static method

Returns a new Time object from native timezone name
public static fromNative ( ) : self
return self
Exemplo n.º 1
0
 /**
  * Returns a new DateTime object from native values
  *
  * @param int    $year
  * @param string $month
  * @param int    $day
  * @param int    $hour
  * @param int    $minute
  * @param int    $second
  * @param string $timezone
  *
  * @return DateTimeWithTimeZone
  */
 public static function fromNative()
 {
     $args = func_get_args();
     $datetime = DateTime::fromNative($args[0], $args[1], $args[2], $args[3], $args[4], $args[5]);
     $timezone = TimeZone::fromNative($args[6]);
     return new static($datetime, $timezone);
 }
Exemplo n.º 2
0
 public function testFromNative()
 {
     $fromNativeTimeZone = TimeZone::fromNative('Europe/Madrid');
     $constructedTimeZone = new TimeZone(new StringLiteral('Europe/Madrid'));
     $this->assertTrue($fromNativeTimeZone->sameValueAs($constructedTimeZone));
 }