public static function getTimeZoneObject($tz, $ignoreDst = false)
	{
		// If the time zone object is not set, attempt to build it.
		if (!($tz instanceof DateTimeZone))
		{
			if ($tz === null)
			{
				$tz = self::$gmt;
			}
			elseif (is_numeric($tz))
			{
				// Translate from offset.
				$tz = new DateTimeZone(self::$offsets[(string) $tz]);
			}
			elseif (is_string($tz))
			{
				$tz = new DateTimeZone($tz);
			}
		}

		if ($ignoreDst)
		{
			$lastYear = self::of('-1 year')->toUnix();
			$currentDate = self::of('now')->toUnix();
			$transitions = $tz->getTransitions($lastYear, $currentDate);
			$offsets = array_reduce($transitions, function($carry, $transition){
				if (empty($transition['isdst']))
				{
					$carry[] = $transition['offset'];
				}
				return $carry;
			});

			if (!empty($offsets))
			{
				$offset = $offsets[0];
				if (abs($offset) > 0)
				{
					// convert seconds to hours
					$offset = $offset / 3600;
				}
				$tz = new DateTimeZone($offset);
			}
		}
		return $tz;
	}
public static function getTimeZoneObject($tz, $ignoreDst = false)
	{
		// If the time zone object is not set, attempt to build it.
		if (!($tz instanceof DateTimeZone))
		{
			if ($tz === null)
			{
				$tz = self::$gmt;
			}
			elseif (is_numeric($tz))
			{
				// Translate from offset.
				$tz = new DateTimeZone(self::$offsets[(string) $tz]);
			}
			elseif (is_string($tz))
			{
				$tz = new DateTimeZone($tz);
			}
		}

		if ($ignoreDst)
		{
			$lastYear = self::of('-1 year')->toUnix();
			$currentDate = self::of('now')->toUnix();
			$transitions = $tz->getTransitions($lastYear, $currentDate);
			$offsets = array_reduce($transitions, function($carry, $transition){
				if (empty($transition['isdst']))
				{
					$carry[] = $transition['offset'];
				}
				return $carry;
			});

			if (!empty($offsets))
			{
				$offset = $offsets[0];
				if (abs($offset) > 0)
				{
					// convert seconds to hours
					$offset = $offset / 3600;
				}
				$tz = new DateTimeZone($offset);
			}
		}
		return $tz;
	}
public static function getTimeZoneObject ( $ tz , $ ignoreDst = false ) { // If the time zone object is not set, attempt to build it. if ( ! ( $ tz instanceof DateTimeZone ) ) { if ( $ tz === null ) { $ tz = self :: $ gmt ; } elseif ( is_numeric ( $ tz ) ) { // Translate from offset. $ tz = new DateTimeZone ( self :: $ offsets [ ( string ) $ tz ] ) ; } elseif ( is_string ( $ tz ) ) { $ tz = new DateTimeZone ( $ tz ) ; } } if ( $ ignoreDst ) { $ lastYear = self :: of ( '-1 year' ) -> toUnix ( ) ; $ currentDate = self :: of ( 'now' ) -> toUnix ( ) ; $ transitions = $ tz -> getTransitions ( $ lastYear , $ currentDate ) ; $ offsets = array_reduce ( $ transitions , function ( $ carry , $ transition ) { if ( empty ( $ transition [ 'isdst' ] ) ) { $ carry [ ] = $ transition [ 'offset' ] ; } return $ carry ; } ) ; if ( ! empty ( $ offsets ) ) { $ offset = $ offsets [ 0 ] ; if ( abs ( $ offset ) > 0 ) { // convert seconds to hours $ offset = $ offset / 3600 ; } $ tz = new DateTimeZone ( $ offset ) ; } } return $ tz ; }
Get TimeZone object for setting the timezone on the provided time.

@param   mixed   $tz    Time zone in either string, offset number, or a TimeZone object.
@param	boolean	$ignoreDst	if set to true, will prevent the date from converting to DST.
@return	object
Get TimeZone object for setting the timezone on the provided time .