Calendar getTimeZone() Method in Java with Examples Last Updated : 29 Jul, 2021 Summarize Comments Improve Suggest changes Share Like Article Like Report The getTimeZone() method in Calendar class is used to return the current time-zone of this Calendar. Syntax: public TimeZone getTimeZone() Parameters: The method does not take any parameters.Return Value: The method returns timezone of this Calendar object. Below programs illustrate the working of getTimeZone() Method of Calendar class: Example 1: Java // Java code to illustrate // getTimeZone() method import java.util.*; public class Calendar_Demo { public static void main(String args[]) { // Creating a calendar object Calendar calndr = Calendar.getInstance(); // Getting the time zone of calendar TimeZone time_zone = calndr.getTimeZone(); // Displaying the current time zone System.out.println("The current Time zone is: " + time_zone.getDisplayName()); } } Output: The current Time zone is: Coordinated Universal Time Example 2: Java // Java code to illustrate // getTimeZone() method import java.util.*; public class Calendar_Demo { public static void main(String args[]) { // Creating a calendar object Calendar calndr = Calendar.getInstance(); // Getting the time zone of calendar TimeZone time_zone = calndr.getTimeZone(); // Displaying the current time zone System.out.println("The current Time zone is: " + time_zone.getDisplayName()); // Changing the time zone calndr.setTimeZone( TimeZone.getTimeZone("GMT")); System.out.println("New TimeZone: " + calndr.getTimeZone() .getDisplayName()); } } Output: The current Time zone is: Coordinated Universal Time New TimeZone: Greenwich Mean Time Reference: https://docs.oracle.com/javase/8/docs/api/java/util/Calendar.html#getTimeZone-- Comment More infoAdvertise with us Next Article Date getTime() method in Java with Examples C chinmoy lenka Follow Improve Article Tags : Misc Java Java - util package Java-Functions Java-Calendar +1 More Practice Tags : JavaMisc Similar Reads Calendar getInstance() Method in Java with Examples The getInstance() method in Calendar class is used to get a calendar using the current time zone and locale of the system. Syntax: public static Calendar getInstance() Parameters: The method does not take any parameters. Return Value: The method returns the calendar. Below program illustrates the wo 1 min read DateFormat getTimeZone() Method in Java with Examples The getTimeZone() method in DateFormat class is used to return the current time-zone of the calendar of this DateFormat. Syntax: public TimeZone getTimeZone() Parameters: The method does not take any parameters. Return Value: The method returns timezone associated with the calendar of DateFormat. Be 1 min read Date getTime() method in Java with Examples The getTime() method of Java Date class returns the number of milliseconds since January 1, 1970, 00:00:00 GTM which is represented by Date object. Syntax: public long getTime() Parameters: The function does not accept any parameter. Return Value: It returns the number of milliseconds since January 2 min read TimeZone getTimeZone() Method in Java with Examples The getTimeZone() method of TimeZone class in Java is used to know the actual TimeZone for any passed TimeZone ID. Syntax: public static TimeZone getTimeZone(String the_ID) Parameters: The method takes one parameter the_ID of string datatype which refers to the ID of which the TimeZone is needed to 1 min read Java 8 Clock getZone() method with Examples Java Clock class is part of Date Time API, java.time.Clock, of Java. The Java Date Time API was added from Java version 8.getZone() method of Clock class returns the time-zone used to create dates and times of Clock class. Every Clock class needs a Time Zone for obtaining the current instant of time 2 min read Calendar setTime() Method in Java with Examples The setTime(Date dt) method in Calendar class is used to set Calendars time represented by this Calendar's time value, with the given or passed date as a parameter. Syntax: public final void setTime(Date dt)) Parameters: The method takes one parameter dt of Date type and refers to the given date tha 2 min read Like