Calendar

Get current TimeZone using Java Calendar

Want to learn quickly?
Try one of the many quizzes. More than Java 400 questions with detailed answers.

Add Comment

  • Why do we need import java.util.TimeZone;

    The program can run without that as well.

    import java.util.Calendar;

    public class CalendarEx {
    public static void main(String[] args) {
    Calendar cal = Calendar.getInstance();
    System.out.println(cal.getTimeZone().getDisplayName());
    }
    }

Sponsors

Facebook Fans