Java Calendar ERA

Syntax

Calendar.ERA has the following syntax.

public static final int ERA

Example

In the following code shows how to use Calendar.ERA field.


import java.util.Calendar;
//from  w ww  .  j av a 2 s  .co m
public class Main {
  public static void main(String[] args) {
    Calendar now = Calendar.getInstance();
    System.out.println(now.getTime());
    System.out.println(now.get(Calendar.ERA));
  }
}

The code above generates the following result.