Here you can find the source of setTimeZone(String name)
Parameter | Description |
---|---|
name | a parameter |
public static void setTimeZone(String name)
//package com.java2s; // * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file * import java.util.*; public class Main { private static ThreadLocal<TimeZone> systemTimeZone = new ThreadLocal<TimeZone>(); /**//from ww w . j av a 2 s . c o m * Temporarily sets the default system timezone to the specified timezone ID. * Use {@link #unsetTimeZone()} to unset it. * * @param name */ public static void setTimeZone(String name) { systemTimeZone.set(TimeZone.getDefault()); TimeZone.setDefault(TimeZone.getTimeZone(name)); } }