Get current TimeZone using Calendar in Java


The following code shows how to get current TimeZone using Calendar.


/* w w w  .  jav a 2s . co m*/
import java.util.Calendar;
import java.util.TimeZone;

public class Main {

  public static void main(String[] args) {
    Calendar now = Calendar.getInstance();
    TimeZone timeZone = now.getTimeZone();
    System.out.println("Current TimeZone is : " + timeZone.getDisplayName());

The code above generates the following result.

Home »
  Java Tutorial »
    Date »

Date Get
Date Set
Date Format
Date Compare
Date Convert
Date Calculation
Date Parse