Java Date Time - 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 ava2 s .com*/

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.