Java Date Time - 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  ava2  s .  c o m
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.