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.
/*from w w w.j a va 2 s . co 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.
Home »
Java Tutorial »
java.util »
Java Tutorial »
java.util »