Example usage for java.util TimeZone getAvailableIDs

List of usage examples for java.util TimeZone getAvailableIDs

Introduction

In this page you can find the example usage for java.util TimeZone getAvailableIDs.

Prototype

public static synchronized String[] getAvailableIDs() 

Source Link

Document

Gets all the available IDs supported.

Usage

From source file:org.apache.oozie.cli.OozieCLI.java

private void printAvailableTimeZones() {
    System.out.println("The format is \"SHORT_NAME (ID)\"\nGive the ID to the -timezone argument");
    System.out.println("GMT offsets can also be used (e.g. GMT-07:00, GMT-0700, GMT+05:30, GMT+0530)");
    System.out.println("Available Time Zones:");
    for (String tzId : TimeZone.getAvailableIDs()) {
        // skip id's that are like "Etc/GMT+01:00" because their display names are like "GMT-01:00", which is confusing
        if (!tzId.startsWith("Etc/GMT")) {
            TimeZone tZone = TimeZone.getTimeZone(tzId);
            System.out.println("      " + tZone.getDisplayName(false, TimeZone.SHORT) + " (" + tzId + ")");
        }/*from   w  w  w. ja  va 2s  .  c  om*/
    }
}