Java Date Time - 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  ww.  j  ava  2s .  com*/
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.