java.util.TimeZone.getID() Method



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()

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