/** * 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() { $fromNativeDateTime = DateTime::fromNative(2013, 'December', 21, 10, 20, 34); $constructedDateTime = new DateTime(new Date(new Year(2013), Month::DECEMBER(), new MonthDay(21)), new Time(new Hour(10), new Minute(20), new Second(34))); $this->assertTrue($fromNativeDateTime->sameValueAs($constructedDateTime)); }