Java Program to get timezone id strings

Java 8Object Oriented ProgrammingProgramming

Let us get the timezone id strings for timezone America. For this, use the get.AvailableZoneIds() method −

ZoneId.getAvailableZoneIds().stream().filter(s ->s.startsWith("America"))
.forEach(System.out::println);

With that, we have used the forEach to display all the timezones in America −

America/Cuiaba
America/Marigot
America/El_Salvador
America/Guatemala
America/Belize
America/Panama
America/Managua
America/Indiana/Petersburg
America/Chicago
America/Tegucigalpa
America/Eirunepe
America/Miquelon
.
.
.

Example

import java.time.ZoneId;
public class Demo {
   public static void main(String[] args) {
      System.out.println("TimeZones in the US");
      ZoneId.getAvailableZoneIds().stream().filter(s ->s.startsWith("America"))
      .forEach(System.out::println);
   }
}

Output

TimeZones in the US
America/Cuiaba
America/Marigot
America/El_Salvador
America/Guatemala
America/Belize
America/Panama
America/Managua
America/Indiana/Petersburg
America/Chicago
America/Tegucigalpa
America/Eirunepe
America/Miquelon
America/Argentina/Catamarca
America/Grand_Turk
America/Argentina/Cordoba
America/Araguaina
America/Argentina/Salta
America/Montevideo
America/Manaus
America/Argentina/Mendoza
America/Argentina/Rio_Gallegos
America/Catamarca
America/Godthab
America/Cordoba
America/Regina
America/Fort_Wayne
America/Dawson_Creek
America/St_Johns
America/St_Thomas
America/Anguilla
America/Denver
America/Havana
America/Porto_Acre
America/Barbados
America/Louisville
America/Sao_Paulo
America/Curacao
America/Guyana
America/Guayaquil
America/Martinique
America/Puerto_Rico
America/Rankin_Inlet
America/Argentina/Jujuy
America/Port_of_Spain
America/Cayenne
America/Rainy_River
America/Yellowknife
America/Juneau
America/Indiana/Vevay
America/Recife
America/Buenos_Aires
America/Noronha
America/Swift_Current
America/Metlakatla
America/Paramaribo
America/Indiana/Vincennes
America/Kralendijk
America/Antigua
America/Indianapolis
America/Inuvik
America/Iqaluit
America/Moncton
America/St_Vincent
America/Kentucky/Louisville
America/Yakutat
America/Mazatlan
America/Dominica
America/Mendoza
America/Santarem
America/Asuncion
America/Boise
America/Costa_Rica
America/Dawson
America/Indiana/Knox
America/North_Dakota/Beulah
America/Maceio
America/Atka
America/Monterrey
America/Nassau
America/Jamaica
America/Atikokan
America/Sitka
America/Kentucky/Monticello
America/Coral_Harbour
America/Aruba
America/North_Dakota/Center
America/Cayman
America/Indiana/Tell_City
America/Tijuana
America/Chihuahua
America/Ojinaga
America/Anchorage
America/Halifax
America/Indiana/Indianapolis
America/Argentina/San_Luis
America/Santiago
America/Argentina/Ushuaia
America/La_Paz
America/Thunder_Bay
America/Indiana/Marengo
America/Creston
America/Punta_Arenas
America/Mexico_City
America/Matamoros
America/Blanc-Sablon
America/Knox_IN
America/Bogota
America/Menominee
America/Adak
America/Resolute
America/Edmonton
America/Santo_Domingo
America/Glace_Bay
America/Port-au-Prince
America/St_Barthelemy
America/Nipigon
America/Fortaleza
America/Hermosillo
America/Cancun
America/Lima
America/St_Lucia
America/Bahia_Banderas
America/Montserrat
America/Santa_Isabel
America/Cambridge_Bay
America/Lower_Princes
America/Vancouver
America/Rio_Branco
America/Danmarkshavn
America/Detroit
America/Thule
America/Argentina/La_Rioja
America/Tortola
America/Porto_Velho
America/Scoresbysund
America/Nome
America/Campo_Grande
America/Belem
America/Ensenada
America/Jujuy
America/Bahia
America/Goose_Bay
America/Virgin
America/Pangnirtung
America/Phoenix
America/Whitehorse
America/Montreal
America/Argentina/San_Juan
America/Indiana/Winamac
America/Argentina/ComodRivadavia
America/Boa_Vista
America/Grenada
America/Argentina/Tucuman
America/New_York
America/Merida
America/Rosario
America/St_Kitts
America/Fort_Nelson
America/Caracas
America/Guadeloupe
America/North_Dakota/New_Salem
America/Shiprock
America/Winnipeg
America/Toronto
America/Los_Angeles
America/Argentina/Buenos_Aires
raja
Published on 26-Apr-2019 10:00:00
Advertisements