system/I18n/Time.php
public static function instance(DateTime $dateTime, string $locale = null)
	{
		$date     = $dateTime->format('Y-m-d H:i:s');
		$timezone = $dateTime->getTimezone();

		return new Time($date, $timezone, $locale);
	}
public static function instance(DateTime $dateTime, string $locale = null)
	{
		$date     = $dateTime->format('Y-m-d H:i:s');
		$timezone = $dateTime->getTimezone();

		return new Time($date, $timezone, $locale);
	}
Takes an instance of DateTime and returns an instance of Time with it's same values.

@param \DateTime   $dateTime
@param string|null $locale

@return \CodeIgniter\I18n\Time
@throws \Exception