java.util.TimeZone.getID() Method


Advertisements


Description

The getID() method is used to get the ID of this time zone.

Declaration

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

public String getID()

Parameters

NA

Return Value

The method call returns the ID of this time zone.

Exception

NA

Example

The following example shows the usage of java.util.TimeZone.getID()

Live Demo
package com.tutorialspoint;

import java.util.*;

public class TimeZoneDemo {
   public static void main( String args[] ) {

      // create time zone object     
      TimeZone timezone = TimeZone.getTimeZone("Europe/Paris");

      // checking ID of this time zone         
      System.out.println("ID value is :" + timezone.getID());
   }    
}

Let us compile and run the above program, this will produce the following result.

ID value is :Europe/Paris

java_util_timezone.htm

Advertisements
E-Books Store