java.util.TimeZone.getAvailableIDs() Method

Advertisements


Description

The getAvailableIDs(int rawOffset) method is used to get the available IDs according to the given time zone offset.

Declaration

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

public static String[] getAvailableIDs(int rawOffset)

Parameters

  • rawOffset--This is the given time zone GMT offset.

Return Value

The method call returns an array of IDs, where the time zone for that ID has the specified GMT offset.

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 for offset
      String[] availId = TimeZone.getAvailableIDs(3600000);      
   
      // checking available Ids for offset
      System.out.println("Available Ids for offset 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 for offset are: 
Africa/Algiers
Africa/Bangui
Africa/Brazzaville
Africa/Ceuta
Africa/Douala
Africa/Kinshasa
Africa/Lagos
Africa/Libreville
Africa/Luanda
Africa/Malabo
Africa/Ndjamena
Africa/Niamey
Africa/Porto-Novo
Africa/Tunis
Africa/Windhoek
Arctic/Longyearbyen
Atlantic/Jan_Mayen and so on .........



Advertisements
Advertisements