public function sameAs($testTime, string $timezone = null): bool
	{
		if ($testTime instanceof DateTime)
		{
			$testTime = $testTime->format('Y-m-d H:i:s');
		}
		else if (is_string($testTime))
		{
			$timezone = $timezone ?: $this->timezone;
			$timezone = $timezone instanceof DateTimeZone ? $timezone : new DateTimeZone($timezone);
			$testTime = new DateTime($testTime, $timezone);
			$testTime = $testTime->format('Y-m-d H:i:s');
		}

		$ourTime = $this->toDateTimeString();

		return $testTime === $ourTime;
	}
public function sameAs($testTime, string $timezone = null): bool
	{
		if ($testTime instanceof DateTime)
		{
			$testTime = $testTime->format('Y-m-d H:i:s');
		}
		else if (is_string($testTime))
		{
			$timezone = $timezone ?: $this->timezone;
			$timezone = $timezone instanceof DateTimeZone ? $timezone : new DateTimeZone($timezone);
			$testTime = new DateTime($testTime, $timezone);
			$testTime = $testTime->format('Y-m-d H:i:s');
		}

		$ourTime = $this->toDateTimeString();

		return $testTime === $ourTime;
	}
public function sameAs ( $ testTime , string $ timezone = null ) : bool { if ( $ testTime instanceof DateTime ) { $ testTime = $ testTime -> format ( 'Y-m-d H:i:s' ) ; } else if ( is_string ( $ testTime ) ) { $ timezone = $ timezone ? : $ this -> timezone ; $ timezone = $ timezone instanceof DateTimeZone ? $ timezone : new DateTimeZone ( $ timezone ) ; $ testTime = new DateTime ( $ testTime , $ timezone ) ; $ testTime = $ testTime -> format ( 'Y-m-d H:i:s' ) ; } $ ourTime = $ this -> toDateTimeString ( ) ; return $ testTime === $ ourTime ; }
Ensures that the times are identical, taking timezone into account.

@param Time|DateTime|string $testTime
@param string|null          $timezone

@return boolean
@throws \Exception
Ensures that the times are identical taking timezone into account .