/** * 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); }
public function testFromNative() { $fromNativeTimeZone = TimeZone::fromNative('Europe/Madrid'); $constructedTimeZone = new TimeZone(new StringLiteral('Europe/Madrid')); $this->assertTrue($fromNativeTimeZone->sameValueAs($constructedTimeZone)); }