Java Date Time - Java TimeZone.setDefault(TimeZone zone)








Syntax

TimeZone.setDefault(TimeZone zone) has the following syntax.

public static void setDefault(TimeZone zone)

Example

In the following code shows how to use TimeZone.setDefault(TimeZone zone) method.

// w  ww .  j  ava  2  s  .c  o  m


import java.util.TimeZone;

public class Main {
   public static void main( String args[] ){
       
      
      TimeZone tzone = TimeZone.getTimeZone("America/Los_Angeles");
      
      // set time zone to default
      tzone.setDefault(tzone);

      // checking default time zone
      System.out.println("Default time zone:" +tzone);
   }    
}

The code above generates the following result.