java.util.TimeZone.getAvailableIDs() Method



Description

The getAvailableIDs() method is used to get all the available IDs supported.

Declaration

Following is the declaration for java.util.TimeZone.getAvailableIDs() method.

public static String[] getAvailableIDs()

Parameters

NA

Return Value

The method call returns an array of IDs.

Exception

NA

Example

The following example shows the usage of java.util.TimeZone.getAvailableIDs()

package com.tutorialspoint;

import java.util.*;

public class TimeZoneDemo {
   public static void main( String args[] ) {       

      // getting available Ids 
      String[] availId = TimeZone.getAvailableIDs();      
      
      // checking available Ids
      System.out.println("Available Ids are: ");

      for (int i = 0; i<availId.length; i++) {
         System.out.println(availId[i]);
      } 
   }    
}

Let us compile and run the above program, this will produce the following result.

Available Ids are: 
Etc/GMT+12
Etc/GMT+11
MIT
Pacific/Apia
Pacific/Midway
Pacific/Niue
Pacific/Pago_Pago
Pacific/Samoa
US/Samoa
America/Adak
America/Atka
Etc/GMT+10
HST and so on .........
java_util_timezone.htm
Advertisements