Java Calendar - getActualMinimum() Method
The java.util.Calendar.getActualMinimum() method returns the minimum value that the specified calendar field could have, given the time value of this Calendar.
Syntax
public int getActualMinimum(int field)
Parameters
field |
Specify the calendar field. |
Return Value
Returns the minimum of the given calendar field for the time value of this Calendar.
Exception
NA
Example:
In the example below, the java.util.Calendar.getActualMinimum() method returns the minimum value for the given field for the given time.
import java.util.*; public class MyClass { public static void main(String[] args) { //creating a Calendar object with specified date Calendar Cal = new GregorianCalendar(2015, 1, 25); //printing the Calendar System.out.println("The Calendar is: " + Cal.getTime()); //printing the actual minimum value for day_of_month int mon = Cal.getActualMinimum(Calendar.DAY_OF_MONTH); System.out.println("Actual Minimum for DAY_OF_MONTH: " + mon); } }
The output of the above code will be:
The Calendar is: Wed Feb 25 00:00:00 UTC 2015 Actual Minimum for DAY_OF_MONTH: 1
❮ Java.util - Calendar