$timezone =
static::
$testNow->
getTimezone();
$time =
static::
$testNow->
format('Y-m-d H:i:s'
);
} } $timezone =
$timezone ?:
date_default_timezone_get();
$this->timezone =
$timezone instanceof DateTimeZone ?
$timezone :
new DateTimeZone($timezone);
// If the time string was a relative string (i.e. 'next Tuesday')
// then we need to adjust the time going in so that we have a current
// timezone to work with.
if ($time !== '' &&
static::
hasRelativeKeywords($time)) { $instance =
new DateTime('now',
$this->timezone
);
$instance->
modify($time);
$time =
$instance->
format('Y-m-d H:i:s'
);
} parent::
__construct($time,
$this->timezone
);
} /**
* Returns a new Time instance with the timezone set.
*
* @param DateTimeZone|string|null $timezone
*
* @return self
*
* @throws Exception
*/