devxlogo

March 20, 2019

Get All the Available Time Zones

Before Java 8, this was obtained as a String[] via TimeZone class: String[] zoneIds = TimeZone.getAvailableIDs(); Java 8 comes with a new approach via java.time.ZoneId class: Set zoneIds = ZoneId.getAvailableZoneIds();