src/Common/Service/DateTime.php
public function getAllTimezone()
    {
        //  Hat-tip to: https://gist.github.com/serverdensity/82576
        $aZones     = \DateTimeZone::listIdentifiers();
        $aLocations = ['UTC' => 'Coordinated Universal Time (UTC/GMT)'];

        foreach ($aZones as $sZone) {

            // 0 => Continent, 1 => City
            $aZoneExploded   = explode('/', $sZone);
            $aZoneAcceptable = [
                'Africa',
                'America',
                'Antarctica',
                'Arctic',
                'Asia',
                'Atlantic',
                'Australia',
                'Europe',
                'Indian',
                'Pacific',
            ];

            // Only use "friendly" continent names
            if (in_array($aZoneExploded[0], $aZoneAcceptable)) {
                if (isset($aZoneExploded[1]) != '') {

                    $sArea = str_replace('_', ' ', $aZoneExploded[1]);

                    if (!empty($aZoneExploded[2])) {
                        $sArea = $sArea . ' (' . str_replace('_', ' ', $aZoneExploded[2]) . ')';
                    }

                    // Creates array(DateTimeZone => 'Friendly name')
                    $aLocations[$aZoneExploded[0]][$sZone] = $sArea;
                }
            }
        }

        return $aLocations;
    }
public function getAllTimezone()
    {
        //  Hat-tip to: https://gist.github.com/serverdensity/82576
        $aZones     = \DateTimeZone::listIdentifiers();
        $aLocations = ['UTC' => 'Coordinated Universal Time (UTC/GMT)'];

        foreach ($aZones as $sZone) {

            // 0 => Continent, 1 => City
            $aZoneExploded   = explode('/', $sZone);
            $aZoneAcceptable = [
                'Africa',
                'America',
                'Antarctica',
                'Arctic',
                'Asia',
                'Atlantic',
                'Australia',
                'Europe',
                'Indian',
                'Pacific',
            ];

            // Only use "friendly" continent names
            if (in_array($aZoneExploded[0], $aZoneAcceptable)) {
                if (isset($aZoneExploded[1]) != '') {

                    $sArea = str_replace('_', ' ', $aZoneExploded[1]);

                    if (!empty($aZoneExploded[2])) {
                        $sArea = $sArea . ' (' . str_replace('_', ' ', $aZoneExploded[2]) . ')';
                    }

                    // Creates array(DateTimeZone => 'Friendly name')
                    $aLocations[$aZoneExploded[0]][$sZone] = $sArea;
                }
            }
        }

        return $aLocations;
    }
public function getAllTimezone ( ) { //  Hat-tip to: https://gist.github.com/serverdensity/82576 $ aZones = \ DateTimeZone :: listIdentifiers ( ) ; $ aLocations = [ 'UTC' => 'Coordinated Universal Time (UTC/GMT)' ] ; foreach ( $ aZones as $ sZone ) { // 0 => Continent, 1 => City $ aZoneExploded = explode ( '/' , $ sZone ) ; $ aZoneAcceptable = [ 'Africa' , 'America' , 'Antarctica' , 'Arctic' , 'Asia' , 'Atlantic' , 'Australia' , 'Europe' , 'Indian' , 'Pacific' , ] ; // Only use "friendly" continent names if ( in_array ( $ aZoneExploded [ 0 ] , $ aZoneAcceptable ) ) { if ( isset ( $ aZoneExploded [ 1 ] ) != '' ) { $ sArea = str_replace ( '_' , ' ' , $ aZoneExploded [ 1 ] ) ; if ( ! empty ( $ aZoneExploded [ 2 ] ) ) { $ sArea = $ sArea . ' (' . str_replace ( '_' , ' ' , $ aZoneExploded [ 2 ] ) . ')' ; } // Creates array(DateTimeZone => 'Friendly name') $ aLocations [ $ aZoneExploded [ 0 ] ] [ $ sZone ] = $ sArea ; } } } return $ aLocations ; }
Returns a multi-dimensional array of supported timezones

@return array
Returns a multi - dimensional array of supported timezones