Java Date Time - Java Calendar.internalGet(int field)








Syntax

Calendar.internalGet(int field) has the following syntax.

protected final int internalGet(int field)

Example

In the following code shows how to use Calendar.internalGet(int field) method.

/*www . j  a  v  a2  s  .  c om*/

import java.util.GregorianCalendar;

public class Main extends GregorianCalendar {

   public static void main(String[] args) {

      Main cal = new Main();

      // use internal get to get the year
      System.out.println("Year is : " + cal.internalGet(YEAR));

      // use internal get to get the month
      System.out.println("Month is : " + cal.internalGet(MONTH));

   }
}

The code above generates the following result.