Java TimeZone.setID(String ID)

Syntax

TimeZone.setID(String ID) has the following syntax.

public void setID(String ID)

Example

In the following code shows how to use TimeZone.setID(String ID) method.


/*from w  w  w .j  av a 2  s  .  c om*/

import java.util.TimeZone;

public class Main {
   public static void main( String args[] ){
       
      
      TimeZone tzone = TimeZone.getDefault();
      
      // set time zone ID
      tzone.setID("GMT+08:00");

      // checking time zone ID
      System.out.println("Time zone ID:" +tzone.getID());
   }    
}

The code above generates the following result.