Java GregorianCalendar(TimeZone zone) Constructor

Syntax

GregorianCalendar(TimeZone zone) constructor from GregorianCalendar has the following syntax.

public GregorianCalendar(TimeZone zone)

Example

In the following code shows how to use GregorianCalendar.GregorianCalendar(TimeZone zone) constructor.


import java.util.GregorianCalendar;
import java.util.TimeZone;
//from   w w w  .ja v a  2s .c o m
public class Main {

   public static void main(String[] args) {

      GregorianCalendar cal = new GregorianCalendar(TimeZone.getDefault());

      System.out.println(cal.getTime());
      

   }
}

The code above generates the following result.