GregorianCalendar class getTimeZone()method example

Gets the time zone.


GregorianCalendarclass 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:-27-May-2008
 */
import java.util.*;

public class GetTimeZone {

    public static void main(String[] args) {
//Creating a Calendar    
        GregorianCalendar g = new GregorianCalendar(200463);
//Displays the date of the Calendar
        System.out.println("Current date of the Calendar is: " + g.get(Calendar.DATE));
//Gets the time zone.
        TimeZone t = g.getTimeZone();
//Prints the timeZone
        System.out.println("TimeZone is: " + t.getID());

    }
}

Output of the program:-
Current date of the Calendar is: 3
TimeZone is: Asia/Calcutta

Post Comment
Name:
E-mail:
Contact no :
Comments:
  Refresh Image
Verify Image:
 
 
Your Comment's
 
 
 

HOME | COPYRIGHT | CONTACT US