Java Date Time - Java GregorianCalendar .getMinimum (int field)








Syntax

GregorianCalendar.getMinimum(int field) has the following syntax.

public int getMinimum(int field)

Example

In the following code shows how to use GregorianCalendar.getMinimum(int field) method.

/*from   w  w  w  .  j  ava  2  s. co  m*/

import java.util.*;

public class Main {

   public static void main(String[] args) {


      GregorianCalendar cal =
              (GregorianCalendar) GregorianCalendar.getInstance();

      // get minimum for day_of_month
      int min = cal.getMinimum(GregorianCalendar.DAY_OF_MONTH);
      System.out.println("Minimum:" + min);

      // get minimum for YEAR
      min = cal.getMinimum(GregorianCalendar.YEAR);
      System.out.println("Minimum:" + min);

   }
}

The code above generates the following result.