- Java.util Package Classes
- Java.util - Home
- Java.util - ArrayDeque
- Java.util - ArrayList
- Java.util - Arrays
- Java.util - BitSet
- Java.util - Calendar
- Java.util - Collections
- Java.util - Currency
- Java.util - Date
- Java.util - Dictionary
- Java.util - EnumMap
- Java.util - EnumSet
- Java.util - Formatter
- Java.util - GregorianCalendar
- Java.util - HashMap
- Java.util - HashSet
- Java.util - Hashtable
- Java.util - IdentityHashMap
- Java.util - LinkedHashMap
- Java.util - LinkedHashSet
- Java.util - LinkedList
- Java.util - ListResourceBundle
- Java.util - Locale
- Java.util - Observable
- Java.util - PriorityQueue
- Java.util - Properties
- Java.util - PropertyPermission
- Java.util - PropertyResourceBundle
- Java.util - Random
- Java.util - ResourceBundle
- Java.util - ResourceBundle.Control
- Java.util - Scanner
- Java.util - ServiceLoader
- Java.util - SimpleTimeZone
- Java.util - Stack
- Java.util - StringTokenizer
- Java.util - Timer
- Java.util - TimerTask
- Java.util - TimeZone
- Java.util - TreeMap
- Java.util - TreeSet
- Java.util - UUID
- Java.util - Vector
- Java.util - WeakHashMap
- Java.util Package Extras
- Java.util - Interfaces
- Java.util - Exceptions
- Java.util - Enumerations
- Java.util Useful Resources
- Java.util - Useful Resources
- Java.util - Discussion
Java TimeZone getAvailableIDs() Method
Description
The Java TimeZone 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
Java TimeZone getAvailableIDs(int rawOffset) Method
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
Getting All Available IDs of TimeZones Example
The following example shows the usage of Java TimeZone getAvailableIDs() method to get the available time zoen ids. We've retrieved the available timezone ids using getAvailableIDs in form of String[] and then iterated them to print.
package com.tutorialspoint; import java.util.TimeZone; 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]); } } }
Output
Let us compile and run the above program, this will produce the following result.
Available Ids are: Africa/Abidjan Africa/Accra Africa/Addis_Ababa Africa/Algiers ... VST
Getting All Available IDs of TimeZones with Given Offset Example
The following example shows the usage of Java TimeZone getAvailableIDs(int rawOffset) method to get the available time zoen ids according to the given time zone offset. We've retrieved the available timezone ids using getAvailableIDs in form of String[] and then iterated them to print.
package com.tutorialspoint; import java.util.TimeZone; public class TimeZoneDemo { public static void main( String args[] ) { // getting available Ids String[] availId = TimeZone.getAvailableIDs(3600000); // checking available Ids System.out.println("Available Ids are: "); for (int i = 0; i<availId.length; i++) { System.out.println(availId[i]); } } }
Output
Let us compile and run the above program, this will produce the following result.
Available Ids are: Africa/Algiers Africa/Bangui Africa/Brazzaville ... Poland
To Continue Learning Please Login
Login with Google