Calendar class getTimeZone()method example
Gets the time zone.
Calendar class getTimeZone()method example. This example shows you how to use getTimeZone()method.This method Gets the time zone.
Here is the code:-
/*
* @Program that Gets the time zone.
* GetTimeZone.java
* Author:-RoseIndia Team
* Date:-23-May-2008
*/
import java.util.*;
public class GetTimeZone {
public static void main(String[] args) {
Calendar c= Calendar.getInstance();
//gets the timezone
TimeZone tz = c.getTimeZone();
System.out.println(" Gets the time zone: "+tz.getID());
}
} |
Output of the program:-
| Gets the time zone: Asia/Calcutta |
|