To obtain a reference to a TimeZone object corresponding to a given time zone ID in Java
Description
The following code shows how to to obtain a reference to a TimeZone object corresponding to a given time zone ID.
Example
/*w w w . j av a 2 s. c om*/
import java.util.GregorianCalendar;
import java.util.TimeZone;
public class Main {
public static void main(String[] a) {
GregorianCalendar calendar = new GregorianCalendar(TimeZone.getTimeZone("America/Chicago"));
System.out.println(calendar);
}
}
The code above generates the following result.