Java GregorianCalendar AD

Syntax

GregorianCalendar.AD has the following syntax.

public static final int AD

Example

In the following code shows how to use GregorianCalendar.AD field.


import java.util.Calendar;
import java.util.GregorianCalendar;
/*  ww  w  . j  a  v  a  2 s.c om*/
public class Main {

   public static void main(String[] args) {

      GregorianCalendar cal = new GregorianCalendar();
      
      cal.set(Calendar.ERA, GregorianCalendar.AD);
      
      System.out.println(cal.getTime());
      

   }
}

The code above generates the following result.