TimeZone getAvailableIDs() filter only tzdb timezones

String[] available = TimeZone.getAvailableIDs();

The above piece of code in Java returns both TZDB format timezones and Windows format timezones. Is there a way to make it return just the TZDB timezones? For example, some values it returns are,

AST America/Adak America/Anchorage America/Atka America/Boise PST America/Los_Angeles...

I'm trying to eliminate AST, PST values in it..

Jon Skeet
people
quotationmark

It sounds like you should probably just filter out time zone IDs which don't have a / in. TZDB contains zone IDs such as EET and EST - for example, version 2014a contains the follow IDs of 4 characters or fewer:

"CET", "Cuba", "EET", "EST", "Eire", "GB", "GMT", "GMT0", "HST", "Iran", "MET", "MST", "NZ", "PRC", "ROC", "ROK", "UCT", "UTC", "W-SU", "WET", "Zulu"

Filtering out anything that doesn't contain a / filters out a little bit more than that... it would remove all of:

"CET", "CST6CDT", "Cuba", "EET", "EST", "EST5EDT", "Egypt", "Eire", "GB", "GB-Eire", "GMT", "GMT+0", "GMT-0", "GMT0", "Greenwich", "HST", "Hongkong", "Iceland", "Iran", "Israel", "Jamaica", "Japan", "Kwajalein", "Libya", "MET", "MST", "MST7MDT", "NZ", "NZ-CHAT", "Navajo", "PRC", "PST8PDT", "Poland", "Portugal", "ROC", "ROK", "Singapore", "Turkey", "UCT", "UTC", "Universal", "W-SU", "WET", "Zulu"

So check that list - if there's nothing in there that you mind losing, go with just filtering by /. Note that almost all of the above are actually aliases for other IDs. Only the following are canonical IDs which don't contain /:

"CET", "CST6CDT", "EET", "EST", "EST5EDT", "HST", "MET", "MST", "MST7MDT", "PST8PDT", "WET"

people

See more on this question at Stackoverflow