The getAvailableIDs(int val_offset) method of TimeZone class in Java is used to get the list of all the supported and available IDs in the TimeZone class according to a provided offset value. Syntax:
public static String[] getAvailableIDs(int val_offset)
Parameters: The method takes one parameter val_offset of Integer type which refers to the time zone offset value.. Return Value: The method returns an array of all the available IDs where the time zone for that ID has a specified value. Below programs illustrate the working of getAvailableIDs() Method of TimeZone: Example 1:Â
Java
// Java code to illustrate // getAvailableIDs() method Â
import java.util.*; Â
public class TimeZone_Demo { Â Â Â Â public static void main(String args[]) Â Â Â Â { Â
        // Storing all the available Ids         String[] Id_array             = TimeZone.getAvailableIDs( 7200000 ); Â
        // Displaying all the available Ids         System.out.println("All the available"                            + " Ids are: "); Â
        for ( int count = 0 ;              count < Id_array.length;              count++)             System.out.println(Id_array[count]);     } } |
All the available Ids are: ART Africa/Blantyre Africa/Bujumbura Africa/Cairo Africa/Gaborone Africa/Harare Africa/Johannesburg Africa/Khartoum Africa/Kigali Africa/Lubumbashi Africa/Lusaka Africa/Maputo Africa/Maseru Africa/Mbabane Africa/Tripoli Africa/Windhoek Asia/Amman Asia/Beirut Asia/Damascus Asia/Famagusta Asia/Gaza Asia/Hebron Asia/Jerusalem Asia/Nicosia Asia/Tel_Aviv CAT EET Egypt Etc/GMT-2 Europe/Athens Europe/Bucharest Europe/Chisinau Europe/Helsinki Europe/Kaliningrad Europe/Kiev Europe/Mariehamn Europe/Nicosia Europe/Riga Europe/Sofia Europe/Tallinn Europe/Tiraspol Europe/Uzhgorod Europe/Vilnius Europe/Zaporozhye Israel Libya
Example 2:Â
Java
// Java code to illustrate // getAvailableIDs() method Â
import java.util.*; Â
public class TimeZone_Demo { Â Â Â Â public static void main(String args[]) Â Â Â Â { Â
        // Storing all the available Ids         String[] Id_array             = TimeZone.getAvailableIDs( 36000000 ); Â
        // Displaying all the available Ids         System.out.println("All the available"                            + " Ids are: "); Â
        for ( int count = 0 ;              count < Id_array.length;              count++)             System.out.println(Id_array[count]);     } } |
All the available Ids are: AET Antarctica/DumontDUrville Asia/Ust-Nera Asia/Vladivostok Australia/ACT Australia/Brisbane Australia/Canberra Australia/Currie Australia/Hobart Australia/Lindeman Australia/Melbourne Australia/NSW Australia/Queensland Australia/Sydney Australia/Tasmania Australia/Victoria Etc/GMT-10 Pacific/Chuuk Pacific/Guam Pacific/Port_Moresby Pacific/Saipan Pacific/Truk Pacific/Yap
Reference: https://docs.oracle.com/javase/7/docs/api/java/util/TimeZone.html#getAvailableIDs(int)