Sunday, May 17, 2026
HomeLanguagesJavaCalendar getActualMinimum() Method in Java with Examples

Calendar getActualMinimum() Method in Java with Examples

The getActualMinimum(int field_value) method of Calendar class is used to return the minimum value that the specified calendar field could have, based on the time value of this Calendar.

Syntax:

public int getActualMinimum(int field_value)

Parameters: The method takes one parameter field_value of integer type and refers to the calendar whose minimum value is needed to be returned.

Return Value: The method returns the minimum value of the passed field.

Below programs illustrate the working of getActualMinimum() method of Calendar class:
Example 1:




// Java Code to illustrate
// getActualMinimum() Method
  
import java.util.*;
  
public class CalendarClassDemo {
    public static void main(String args[])
    {
        // Creating a calendar
        Calendar calndr = Calendar.getInstance();
  
        // Getting the Minimum value that
        // year field can have
        int yr
            = calndr.getActualMinimum(Calendar.YEAR);
        System.out.println("The Minimum year: "
                           + yr);
  
        // Getting the Minimum value that
        // month field can have
        int mon
            = calndr.getActualMinimum(Calendar.MONTH);
        System.out.println("The Minimum Month is: "
                           + mon);
    }
}


Output:

The Minimum year: 1
The Minimum Month is: 0

Example 2:




// Java Code to illustrate
// getActualMinimum() Method
  
import java.util.*;
  
public class CalendarClassDemo {
    public static void main(String args[])
    {
        // Creating a calendar object
        Calendar calndr
            = new GregorianCalendar(2018, 9, 2);
  
        // Getting the Minimum value that
        // year field can have
        int yr
            = calndr.getActualMinimum(Calendar.YEAR);
        System.out.println("The Minimum year: "
                           + yr);
  
        // Getting the Minimum value that
        // month field can have
        int mon
            = calndr.getActualMinimum(Calendar.MONTH);
        System.out.println("The Minimum Month is: "
                           + mon);
    }
}


Output:

The Minimum year: 1
The Minimum Month is: 0

Reference: https://docs.oracle.com/javase/7/docs/api/java/util/Calendar.html#getActualMinimum(int)

Dominic
Dominichttp://wardslaus.com
infosec,malicious & dos attacks generator, boot rom exploit philanthropist , wild hacker , game developer,
RELATED ARTICLES

3 COMMENTS

Most Popular

Dominic
32514 POSTS0 COMMENTS
Milvus
131 POSTS0 COMMENTS
Nango Kala
6892 POSTS0 COMMENTS
Nicole Veronica
12012 POSTS0 COMMENTS
Nokonwaba Nkukhwana
12107 POSTS0 COMMENTS
Shaida Kate Naidoo
7016 POSTS0 COMMENTS
Ted Musemwa
7262 POSTS0 COMMENTS
Thapelo Manthata
6975 POSTS0 COMMENTS
Umr Jansen
6963 POSTS0 COMMENTS