Java Programming Tutorials

Java programming tutorials with many code examples!

Java Time ZoneId getAvailableZoneIds

java.time.ZoneId.getAvailableZoneIds()

The method ZoneId.getAvailableZoneIds() returns set of available zone IDs, including all available region-based IDs. Usually passed to of(String zoneId) to create ZoneId.

Method signature

The signature of the java.time.ZoneId.getAvailableZoneIds() method is as follows:

public static Set<String> getAvailableZoneIds()

The method is available since Java 8.

Parameters

The method takes no parameters.

Return value

Returns a modifiable copy of the set of zone ids, never null.

Exceptions

The method throws no exceptions.

Example usage

In the following code we use java.time.ZoneId.getAvailableZoneIds():

package com.farenda.java.time;

import java.time.ZoneId;
import java.util.Set;
import java.util.TreeSet;

public class ZoneIdExample {

    public static void main(String[] args) {
        Set<String> zoneIds = ZoneId.getAvailableZoneIds();
        System.out.printf("Available zones (%d):%n", zoneIds.size());

        // Lets use TreeSet to have them in lexicographically order:
        zoneIds = new TreeSet<>(zoneIds);

        for (String zoneId : zoneIds) {
            System.out.println("Zone id: " + zoneId);
        }
    }
}

The above code produces the following output:

Available zones (590):
Zone id: Africa/Abidjan
Zone id: Africa/Accra
Zone id: Africa/Addis_Ababa
Zone id: Africa/Algiers
Zone id: Africa/Asmara
Zone id: Africa/Asmera
Zone id: Africa/Bamako
Zone id: Africa/Bangui
Zone id: Africa/Banjul
Zone id: Africa/Bissau
Zone id: Africa/Blantyre
Zone id: Africa/Brazzaville
Zone id: Africa/Bujumbura
Zone id: Africa/Cairo
Zone id: Africa/Casablanca
Zone id: Africa/Ceuta
Zone id: Africa/Conakry
Zone id: Africa/Dakar
Zone id: Africa/Dar_es_Salaam
Zone id: Africa/Djibouti
Zone id: Africa/Douala
Zone id: Africa/El_Aaiun
Zone id: Africa/Freetown
Zone id: Africa/Gaborone
Zone id: Africa/Harare
Zone id: Africa/Johannesburg
Zone id: Africa/Juba
Zone id: Africa/Kampala
Zone id: Africa/Khartoum
Zone id: Africa/Kigali
Zone id: Africa/Kinshasa
Zone id: Africa/Lagos
Zone id: Africa/Libreville
Zone id: Africa/Lome
Zone id: Africa/Luanda
Zone id: Africa/Lubumbashi
Zone id: Africa/Lusaka
Zone id: Africa/Malabo
Zone id: Africa/Maputo
Zone id: Africa/Maseru
Zone id: Africa/Mbabane
Zone id: Africa/Mogadishu
Zone id: Africa/Monrovia
Zone id: Africa/Nairobi
Zone id: Africa/Ndjamena
Zone id: Africa/Niamey
Zone id: Africa/Nouakchott
Zone id: Africa/Ouagadougou
Zone id: Africa/Porto-Novo
Zone id: Africa/Sao_Tome
Zone id: Africa/Timbuktu
Zone id: Africa/Tripoli
Zone id: Africa/Tunis
Zone id: Africa/Windhoek
Zone id: America/Adak
Zone id: America/Anchorage
Zone id: America/Anguilla
Zone id: America/Antigua
Zone id: America/Araguaina
Zone id: America/Argentina/Buenos_Aires
Zone id: America/Argentina/Catamarca
Zone id: America/Argentina/ComodRivadavia
Zone id: America/Argentina/Cordoba
Zone id: America/Argentina/Jujuy
Zone id: America/Argentina/La_Rioja
Zone id: America/Argentina/Mendoza
Zone id: America/Argentina/Rio_Gallegos
Zone id: America/Argentina/Salta
Zone id: America/Argentina/San_Juan
Zone id: America/Argentina/San_Luis
Zone id: America/Argentina/Tucuman
Zone id: America/Argentina/Ushuaia
Zone id: America/Aruba
Zone id: America/Asuncion
Zone id: America/Atikokan
Zone id: America/Atka
Zone id: America/Bahia
Zone id: America/Bahia_Banderas
Zone id: America/Barbados
Zone id: America/Belem
Zone id: America/Belize
Zone id: America/Blanc-Sablon
Zone id: America/Boa_Vista
Zone id: America/Bogota
Zone id: America/Boise
Zone id: America/Buenos_Aires
Zone id: America/Cambridge_Bay
Zone id: America/Campo_Grande
Zone id: America/Cancun
Zone id: America/Caracas
Zone id: America/Catamarca
Zone id: America/Cayenne
Zone id: America/Cayman
Zone id: America/Chicago
Zone id: America/Chihuahua
Zone id: America/Coral_Harbour
Zone id: America/Cordoba
Zone id: America/Costa_Rica
Zone id: America/Creston
Zone id: America/Cuiaba
Zone id: America/Curacao
Zone id: America/Danmarkshavn
Zone id: America/Dawson
Zone id: America/Dawson_Creek
Zone id: America/Denver
Zone id: America/Detroit
Zone id: America/Dominica
Zone id: America/Edmonton
Zone id: America/Eirunepe
Zone id: America/El_Salvador
Zone id: America/Ensenada
Zone id: America/Fort_Nelson
Zone id: America/Fort_Wayne
Zone id: America/Fortaleza
Zone id: America/Glace_Bay
Zone id: America/Godthab
Zone id: America/Goose_Bay
Zone id: America/Grand_Turk
Zone id: America/Grenada
Zone id: America/Guadeloupe
Zone id: America/Guatemala
Zone id: America/Guayaquil
Zone id: America/Guyana
Zone id: America/Halifax
Zone id: America/Havana
Zone id: America/Hermosillo
Zone id: America/Indiana/Indianapolis
Zone id: America/Indiana/Knox
Zone id: America/Indiana/Marengo
Zone id: America/Indiana/Petersburg
Zone id: America/Indiana/Tell_City
Zone id: America/Indiana/Vevay
Zone id: America/Indiana/Vincennes
Zone id: America/Indiana/Winamac
Zone id: America/Indianapolis
Zone id: America/Inuvik
Zone id: America/Iqaluit
Zone id: America/Jamaica
Zone id: America/Jujuy
Zone id: America/Juneau
Zone id: America/Kentucky/Louisville
Zone id: America/Kentucky/Monticello
Zone id: America/Knox_IN
Zone id: America/Kralendijk
Zone id: America/La_Paz
Zone id: America/Lima
Zone id: America/Los_Angeles
Zone id: America/Louisville
Zone id: America/Lower_Princes
Zone id: America/Maceio
Zone id: America/Managua
Zone id: America/Manaus
Zone id: America/Marigot
Zone id: America/Martinique
Zone id: America/Matamoros
Zone id: America/Mazatlan
Zone id: America/Mendoza
Zone id: America/Menominee
Zone id: America/Merida
Zone id: America/Metlakatla
Zone id: America/Mexico_City
Zone id: America/Miquelon
Zone id: America/Moncton
Zone id: America/Monterrey
Zone id: America/Montevideo
Zone id: America/Montreal
Zone id: America/Montserrat
Zone id: America/Nassau
Zone id: America/New_York
Zone id: America/Nipigon
Zone id: America/Nome
Zone id: America/Noronha
Zone id: America/North_Dakota/Beulah
Zone id: America/North_Dakota/Center
Zone id: America/North_Dakota/New_Salem
Zone id: America/Ojinaga
Zone id: America/Panama
Zone id: America/Pangnirtung
Zone id: America/Paramaribo
Zone id: America/Phoenix
Zone id: America/Port-au-Prince
Zone id: America/Port_of_Spain
Zone id: America/Porto_Acre
Zone id: America/Porto_Velho
Zone id: America/Puerto_Rico
Zone id: America/Rainy_River
Zone id: America/Rankin_Inlet
Zone id: America/Recife
Zone id: America/Regina
Zone id: America/Resolute
Zone id: America/Rio_Branco
Zone id: America/Rosario
Zone id: America/Santa_Isabel
Zone id: America/Santarem
Zone id: America/Santiago
Zone id: America/Santo_Domingo
Zone id: America/Sao_Paulo
Zone id: America/Scoresbysund
Zone id: America/Shiprock
Zone id: America/Sitka
Zone id: America/St_Barthelemy
Zone id: America/St_Johns
Zone id: America/St_Kitts
Zone id: America/St_Lucia
Zone id: America/St_Thomas
Zone id: America/St_Vincent
Zone id: America/Swift_Current
Zone id: America/Tegucigalpa
Zone id: America/Thule
Zone id: America/Thunder_Bay
Zone id: America/Tijuana
Zone id: America/Toronto
Zone id: America/Tortola
Zone id: America/Vancouver
Zone id: America/Virgin
Zone id: America/Whitehorse
Zone id: America/Winnipeg
Zone id: America/Yakutat
Zone id: America/Yellowknife
Zone id: Antarctica/Casey
Zone id: Antarctica/Davis
Zone id: Antarctica/DumontDUrville
Zone id: Antarctica/Macquarie
Zone id: Antarctica/Mawson
Zone id: Antarctica/McMurdo
Zone id: Antarctica/Palmer
Zone id: Antarctica/Rothera
Zone id: Antarctica/South_Pole
Zone id: Antarctica/Syowa
Zone id: Antarctica/Troll
Zone id: Antarctica/Vostok
Zone id: Arctic/Longyearbyen
Zone id: Asia/Aden
Zone id: Asia/Almaty
Zone id: Asia/Amman
Zone id: Asia/Anadyr
Zone id: Asia/Aqtau
Zone id: Asia/Aqtobe
Zone id: Asia/Ashgabat
Zone id: Asia/Ashkhabad
Zone id: Asia/Baghdad
Zone id: Asia/Bahrain
Zone id: Asia/Baku
Zone id: Asia/Bangkok
Zone id: Asia/Beirut
Zone id: Asia/Bishkek
Zone id: Asia/Brunei
Zone id: Asia/Calcutta
Zone id: Asia/Chita
Zone id: Asia/Choibalsan
Zone id: Asia/Chongqing
Zone id: Asia/Chungking
Zone id: Asia/Colombo
Zone id: Asia/Dacca
Zone id: Asia/Damascus
Zone id: Asia/Dhaka
Zone id: Asia/Dili
Zone id: Asia/Dubai
Zone id: Asia/Dushanbe
Zone id: Asia/Gaza
Zone id: Asia/Harbin
Zone id: Asia/Hebron
Zone id: Asia/Ho_Chi_Minh
Zone id: Asia/Hong_Kong
Zone id: Asia/Hovd
Zone id: Asia/Irkutsk
Zone id: Asia/Istanbul
Zone id: Asia/Jakarta
Zone id: Asia/Jayapura
Zone id: Asia/Jerusalem
Zone id: Asia/Kabul
Zone id: Asia/Kamchatka
Zone id: Asia/Karachi
Zone id: Asia/Kashgar
Zone id: Asia/Kathmandu
Zone id: Asia/Katmandu
Zone id: Asia/Khandyga
Zone id: Asia/Kolkata
Zone id: Asia/Krasnoyarsk
Zone id: Asia/Kuala_Lumpur
Zone id: Asia/Kuching
Zone id: Asia/Kuwait
Zone id: Asia/Macao
Zone id: Asia/Macau
Zone id: Asia/Magadan
Zone id: Asia/Makassar
Zone id: Asia/Manila
Zone id: Asia/Muscat
Zone id: Asia/Nicosia
Zone id: Asia/Novokuznetsk
Zone id: Asia/Novosibirsk
Zone id: Asia/Omsk
Zone id: Asia/Oral
Zone id: Asia/Phnom_Penh
Zone id: Asia/Pontianak
Zone id: Asia/Pyongyang
Zone id: Asia/Qatar
Zone id: Asia/Qyzylorda
Zone id: Asia/Rangoon
Zone id: Asia/Riyadh
Zone id: Asia/Saigon
Zone id: Asia/Sakhalin
Zone id: Asia/Samarkand
Zone id: Asia/Seoul
Zone id: Asia/Shanghai
Zone id: Asia/Singapore
Zone id: Asia/Srednekolymsk
Zone id: Asia/Taipei
Zone id: Asia/Tashkent
Zone id: Asia/Tbilisi
Zone id: Asia/Tehran
Zone id: Asia/Tel_Aviv
Zone id: Asia/Thimbu
Zone id: Asia/Thimphu
Zone id: Asia/Tokyo
Zone id: Asia/Ujung_Pandang
Zone id: Asia/Ulaanbaatar
Zone id: Asia/Ulan_Bator
Zone id: Asia/Urumqi
Zone id: Asia/Ust-Nera
Zone id: Asia/Vientiane
Zone id: Asia/Vladivostok
Zone id: Asia/Yakutsk
Zone id: Asia/Yekaterinburg
Zone id: Asia/Yerevan
Zone id: Atlantic/Azores
Zone id: Atlantic/Bermuda
Zone id: Atlantic/Canary
Zone id: Atlantic/Cape_Verde
Zone id: Atlantic/Faeroe
Zone id: Atlantic/Faroe
Zone id: Atlantic/Jan_Mayen
Zone id: Atlantic/Madeira
Zone id: Atlantic/Reykjavik
Zone id: Atlantic/South_Georgia
Zone id: Atlantic/St_Helena
Zone id: Atlantic/Stanley
Zone id: Australia/ACT
Zone id: Australia/Adelaide
Zone id: Australia/Brisbane
Zone id: Australia/Broken_Hill
Zone id: Australia/Canberra
Zone id: Australia/Currie
Zone id: Australia/Darwin
Zone id: Australia/Eucla
Zone id: Australia/Hobart
Zone id: Australia/LHI
Zone id: Australia/Lindeman
Zone id: Australia/Lord_Howe
Zone id: Australia/Melbourne
Zone id: Australia/NSW
Zone id: Australia/North
Zone id: Australia/Perth
Zone id: Australia/Queensland
Zone id: Australia/South
Zone id: Australia/Sydney
Zone id: Australia/Tasmania
Zone id: Australia/Victoria
Zone id: Australia/West
Zone id: Australia/Yancowinna
Zone id: Brazil/Acre
Zone id: Brazil/DeNoronha
Zone id: Brazil/East
Zone id: Brazil/West
Zone id: CET
Zone id: CST6CDT
Zone id: Canada/Atlantic
Zone id: Canada/Central
Zone id: Canada/East-Saskatchewan
Zone id: Canada/Eastern
Zone id: Canada/Mountain
Zone id: Canada/Newfoundland
Zone id: Canada/Pacific
Zone id: Canada/Saskatchewan
Zone id: Canada/Yukon
Zone id: Chile/Continental
Zone id: Chile/EasterIsland
Zone id: Cuba
Zone id: EET
Zone id: EST5EDT
Zone id: Egypt
Zone id: Eire
Zone id: Etc/GMT
Zone id: Etc/GMT+0
Zone id: Etc/GMT+1
Zone id: Etc/GMT+10
Zone id: Etc/GMT+11
Zone id: Etc/GMT+12
Zone id: Etc/GMT+2
Zone id: Etc/GMT+3
Zone id: Etc/GMT+4
Zone id: Etc/GMT+5
Zone id: Etc/GMT+6
Zone id: Etc/GMT+7
Zone id: Etc/GMT+8
Zone id: Etc/GMT+9
Zone id: Etc/GMT-0
Zone id: Etc/GMT-1
Zone id: Etc/GMT-10
Zone id: Etc/GMT-11
Zone id: Etc/GMT-12
Zone id: Etc/GMT-13
Zone id: Etc/GMT-14
Zone id: Etc/GMT-2
Zone id: Etc/GMT-3
Zone id: Etc/GMT-4
Zone id: Etc/GMT-5
Zone id: Etc/GMT-6
Zone id: Etc/GMT-7
Zone id: Etc/GMT-8
Zone id: Etc/GMT-9
Zone id: Etc/GMT0
Zone id: Etc/Greenwich
Zone id: Etc/UCT
Zone id: Etc/UTC
Zone id: Etc/Universal
Zone id: Etc/Zulu
Zone id: Europe/Amsterdam
Zone id: Europe/Andorra
Zone id: Europe/Athens
Zone id: Europe/Belfast
Zone id: Europe/Belgrade
Zone id: Europe/Berlin
Zone id: Europe/Bratislava
Zone id: Europe/Brussels
Zone id: Europe/Bucharest
Zone id: Europe/Budapest
Zone id: Europe/Busingen
Zone id: Europe/Chisinau
Zone id: Europe/Copenhagen
Zone id: Europe/Dublin
Zone id: Europe/Gibraltar
Zone id: Europe/Guernsey
Zone id: Europe/Helsinki
Zone id: Europe/Isle_of_Man
Zone id: Europe/Istanbul
Zone id: Europe/Jersey
Zone id: Europe/Kaliningrad
Zone id: Europe/Kiev
Zone id: Europe/Lisbon
Zone id: Europe/Ljubljana
Zone id: Europe/London
Zone id: Europe/Luxembourg
Zone id: Europe/Madrid
Zone id: Europe/Malta
Zone id: Europe/Mariehamn
Zone id: Europe/Minsk
Zone id: Europe/Monaco
Zone id: Europe/Moscow
Zone id: Europe/Nicosia
Zone id: Europe/Oslo
Zone id: Europe/Paris
Zone id: Europe/Podgorica
Zone id: Europe/Prague
Zone id: Europe/Riga
Zone id: Europe/Rome
Zone id: Europe/Samara
Zone id: Europe/San_Marino
Zone id: Europe/Sarajevo
Zone id: Europe/Simferopol
Zone id: Europe/Skopje
Zone id: Europe/Sofia
Zone id: Europe/Stockholm
Zone id: Europe/Tallinn
Zone id: Europe/Tirane
Zone id: Europe/Tiraspol
Zone id: Europe/Uzhgorod
Zone id: Europe/Vaduz
Zone id: Europe/Vatican
Zone id: Europe/Vienna
Zone id: Europe/Vilnius
Zone id: Europe/Volgograd
Zone id: Europe/Warsaw
Zone id: Europe/Zagreb
Zone id: Europe/Zaporozhye
Zone id: Europe/Zurich
Zone id: GB
Zone id: GB-Eire
Zone id: GMT
Zone id: GMT0
Zone id: Greenwich
Zone id: Hongkong
Zone id: Iceland
Zone id: Indian/Antananarivo
Zone id: Indian/Chagos
Zone id: Indian/Christmas
Zone id: Indian/Cocos
Zone id: Indian/Comoro
Zone id: Indian/Kerguelen
Zone id: Indian/Mahe
Zone id: Indian/Maldives
Zone id: Indian/Mauritius
Zone id: Indian/Mayotte
Zone id: Indian/Reunion
Zone id: Iran
Zone id: Israel
Zone id: Jamaica
Zone id: Japan
Zone id: Kwajalein
Zone id: Libya
Zone id: MET
Zone id: MST7MDT
Zone id: Mexico/BajaNorte
Zone id: Mexico/BajaSur
Zone id: Mexico/General
Zone id: NZ
Zone id: NZ-CHAT
Zone id: Navajo
Zone id: PRC
Zone id: PST8PDT
Zone id: Pacific/Apia
Zone id: Pacific/Auckland
Zone id: Pacific/Bougainville
Zone id: Pacific/Chatham
Zone id: Pacific/Chuuk
Zone id: Pacific/Easter
Zone id: Pacific/Efate
Zone id: Pacific/Enderbury
Zone id: Pacific/Fakaofo
Zone id: Pacific/Fiji
Zone id: Pacific/Funafuti
Zone id: Pacific/Galapagos
Zone id: Pacific/Gambier
Zone id: Pacific/Guadalcanal
Zone id: Pacific/Guam
Zone id: Pacific/Honolulu
Zone id: Pacific/Johnston
Zone id: Pacific/Kiritimati
Zone id: Pacific/Kosrae
Zone id: Pacific/Kwajalein
Zone id: Pacific/Majuro
Zone id: Pacific/Marquesas
Zone id: Pacific/Midway
Zone id: Pacific/Nauru
Zone id: Pacific/Niue
Zone id: Pacific/Norfolk
Zone id: Pacific/Noumea
Zone id: Pacific/Pago_Pago
Zone id: Pacific/Palau
Zone id: Pacific/Pitcairn
Zone id: Pacific/Pohnpei
Zone id: Pacific/Ponape
Zone id: Pacific/Port_Moresby
Zone id: Pacific/Rarotonga
Zone id: Pacific/Saipan
Zone id: Pacific/Samoa
Zone id: Pacific/Tahiti
Zone id: Pacific/Tarawa
Zone id: Pacific/Tongatapu
Zone id: Pacific/Truk
Zone id: Pacific/Wake
Zone id: Pacific/Wallis
Zone id: Pacific/Yap
Zone id: Poland
Zone id: Portugal
Zone id: ROK
Zone id: Singapore
Zone id: SystemV/AST4
Zone id: SystemV/AST4ADT
Zone id: SystemV/CST6
Zone id: SystemV/CST6CDT
Zone id: SystemV/EST5
Zone id: SystemV/EST5EDT
Zone id: SystemV/HST10
Zone id: SystemV/MST7
Zone id: SystemV/MST7MDT
Zone id: SystemV/PST8
Zone id: SystemV/PST8PDT
Zone id: SystemV/YST9
Zone id: SystemV/YST9YDT
Zone id: Turkey
Zone id: UCT
Zone id: US/Alaska
Zone id: US/Aleutian
Zone id: US/Arizona
Zone id: US/Central
Zone id: US/East-Indiana
Zone id: US/Eastern
Zone id: US/Hawaii
Zone id: US/Indiana-Starke
Zone id: US/Michigan
Zone id: US/Mountain
Zone id: US/Pacific
Zone id: US/Pacific-New
Zone id: US/Samoa
Zone id: UTC
Zone id: Universal
Zone id: W-SU
Zone id: WET
Zone id: Zulu

References:

Share with the World!