Java Calendar - getMinimum() Method
The java.util.Calendar.getMinimum() method returns the minimum value for the given calendar field of this Calendar instance. The minimum value is defined as the smallest value returned by the get method for any possible time value. The minimum value depends on calendar system specific parameters of the instance.
Syntax
public abstract int getMinimum(int field)
Parameters
field |
Specify the calendar field. |
Return Value
Returns the minimum value for the given calendar field.
Exception
NA
Example:
In the example below, the java.util.Calendar.getMinimum() method returns the minimum value for the given calendar field.
import java.util.*; public class MyClass { public static void main(String[] args) { //creating a Calendar object with specified date Calendar Cal = new GregorianCalendar(2015, 10, 25); //printing the Calendar System.out.println("The Calendar is: " + Cal.getTime()); //printing the minimum value for day_of_month int mon = Cal.getMinimum(Calendar.DAY_OF_MONTH); System.out.println("Minimum for DAY_OF_MONTH: " + mon); //printing the minimum value for year int yr = Cal.getMinimum(Calendar.YEAR); System.out.println("Minimum for YEAR: " + yr); } }
The output of the above code will be:
The Calendar is: Wed Nov 25 00:00:00 UTC 2015 Minimum for DAY_OF_MONTH: 1 Minimum for YEAR: 1
❮ Java.util - Calendar