Java TimeZone getID() Example

TimeZone class getID() method example. This example shows you how to use getID() method.


Syntax is : public String getID()
Method returns the ID of this time zone.

Here is the code.
/**
 * @(#) GetIdTimeZone.java
 * A class representing use of method getID() of TimeZone
 class in java.util Package.
 * @Version  27-May-2008
 @author   Rose India Team
 */
import java.util.*;

class GetIdTimeZone {
    public static void mainString args[] ){
        // Create object of TimeZone class. 
        TimeZone obj = TimeZone.getDefault();
        // getID() method call for dafault time zone.
      String id = obj.getID();
        System.out.println("Id of the  default time zone is  : " + id);
      obj = TimeZone.getTimeZone("Europe/Paris");
        // getID() method call for specified time zone.
      id = obj.getID();
        System.out.println("Id of the specified time zone is : " + id);
  }
}

Output of the program.
Id of the  default time zone is  : GMT+05:30
Id of the specified time zone is : Europe/Paris

Post Comment
Name:
E-mail:
Contact no :
Comments:
  Refresh Image
Verify Image:
 
 
Your Comment's
 
 
 

HOME | COPYRIGHT | CONTACT US