- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Get the IDs according to the given time zone offset in Java
In order to get the IDs according to the given time zone offset in Java, we use the getAvailableIDs(int rawOffset) method. The java.util.TimeZone.getAvailableIDs(int rawOffset) method returns the available IDs according to the given time zone offset in the arguments.
Declaration − The java.util.TimeZone.getAvailableIDs(int rawOffset) method is declared as follows −
public static String[] getAvailableIDs(int rawOffset)
where rawOffset is the given time zone GMT offset.
Let us see a Java program which gets the IDs according to the given time zone offset −
Example
import java.util.*; public class Example { public static void main(String args[]) { // getting available supported ids for given offset String[] id = TimeZone.getAvailableIDs(36000000); // printing available ids for offset System.out.println("The available IDs are as follows:"); for (int i = 0; i< id.length; i++) { System.out.println(id[i]); } } }
Output
The available IDs are as follows: 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
Advertisements