Java Calendar .getGreatestMinimum ( int field)

Syntax

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

public abstract int getGreatestMinimum(int field)

Example

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


/*ww w  .  j  a  va2  s.co  m*/


import java.util.Calendar;
import java.util.GregorianCalendar;

public class Main {

   public static void main(String[] args) {

      // create a calendar    
      Calendar cal = new GregorianCalendar(2010, 9, 15);

      // print the greatest min. for year field
      int result = cal.getGreatestMinimum(Calendar.YEAR);
      System.out.println("The minimum is: " + result);
   }
}

The code above generates the following result.