public function setTimeZoneId($timeZoneId)
    {
        if (null === $timeZoneId) {
            $timeZoneId = date_default_timezone_get();

            $this->uninitializedTimeZoneId = true;
        }

        // Backup original passed time zone
        $timeZone = $timeZoneId;

        // Get an Etc/GMT time zone that is accepted for \DateTimeZone
        if ('GMT' !== $timeZoneId && 0 === strpos($timeZoneId, 'GMT')) {
            try {
                $timeZoneId = DateFormat\TimezoneTransformer::getEtcTimeZoneId($timeZoneId);
            } catch (\InvalidArgumentException $e) {
                // Does nothing, will fallback to UTC
            }
        }

        try {
            $this->dateTimeZone = new \DateTimeZone($timeZoneId);
            if ('GMT' !== $timeZoneId && $this->dateTimeZone->getName() !== $timeZoneId) {
                $timeZone = $this->getTimeZoneId();
            }
        } catch (\Exception $e) {
            $timeZoneId = $timeZone = $this->getTimeZoneId();
            $this->dateTimeZone = new \DateTimeZone($timeZoneId);
        }

        $this->timeZoneId = $timeZone;

        return true;
    }
public function setTimeZoneId($timeZoneId)
    {
        if (null === $timeZoneId) {
            $timeZoneId = date_default_timezone_get();

            $this->uninitializedTimeZoneId = true;
        }

        // Backup original passed time zone
        $timeZone = $timeZoneId;

        // Get an Etc/GMT time zone that is accepted for \DateTimeZone
        if ('GMT' !== $timeZoneId && 0 === strpos($timeZoneId, 'GMT')) {
            try {
                $timeZoneId = DateFormat\TimezoneTransformer::getEtcTimeZoneId($timeZoneId);
            } catch (\InvalidArgumentException $e) {
                // Does nothing, will fallback to UTC
            }
        }

        try {
            $this->dateTimeZone = new \DateTimeZone($timeZoneId);
            if ('GMT' !== $timeZoneId && $this->dateTimeZone->getName() !== $timeZoneId) {
                $timeZone = $this->getTimeZoneId();
            }
        } catch (\Exception $e) {
            $timeZoneId = $timeZone = $this->getTimeZoneId();
            $this->dateTimeZone = new \DateTimeZone($timeZoneId);
        }

        $this->timeZoneId = $timeZone;

        return true;
    }
public function setTimeZoneId ( $ timeZoneId ) { if ( null === $ timeZoneId ) { $ timeZoneId = date_default_timezone_get ( ) ; $ this -> uninitializedTimeZoneId = true ; } // Backup original passed time zone $ timeZone = $ timeZoneId ; // Get an Etc/GMT time zone that is accepted for \DateTimeZone if ( 'GMT' !== $ timeZoneId && 0 === strpos ( $ timeZoneId , 'GMT' ) ) { try { $ timeZoneId = DateFormat \ TimezoneTransformer :: getEtcTimeZoneId ( $ timeZoneId ) ; } catch ( \ InvalidArgumentException $ e ) { // Does nothing, will fallback to UTC } } try { $ this -> dateTimeZone = new \ DateTimeZone ( $ timeZoneId ) ; if ( 'GMT' !== $ timeZoneId && $ this -> dateTimeZone -> getName ( ) !== $ timeZoneId ) { $ timeZone = $ this -> getTimeZoneId ( ) ; } } catch ( \ Exception $ e ) { $ timeZoneId = $ timeZone = $ this -> getTimeZoneId ( ) ; $ this -> dateTimeZone = new \ DateTimeZone ( $ timeZoneId ) ; } $ this -> timeZoneId = $ timeZone ; return true ; }
Set the formatter's timezone identifier.

@param string|null $timeZoneId The time zone ID string of the time zone to use.
If NULL or the empty string, the default time zone for the
runtime is used.

@return bool true on success or false on failure

@see http://www.php.net/manual/en/intldateformatter.settimezoneid.php
Set the formatter s timezone identifier .