Display Available Time Zones

This example shows how to display all available time zone IDs. These IDs are essential when you want to use classes like Date and Calendar and display the time in another time zone than default.
To retrieve the time zones we call the static method getAvailableIDs of the TimeZone class. It returns an array of strings with the ID of each time zone.
The array returned is quite extensive and to make it easier to find what we’re looking for in the output, we call the sort method of the Arrays class to sort the array.

Since Java 8 there’s a new way of doing this. Follow the link below to see how it’s done, or continue reading this example which also is a valid solution.

List possible time zones (or ZoneIds) in Java

The output looks like this:

Search for more Java info on this site here:
Custom Search

Please type any questions here.