.getActualMinimum()
Anonymous contributor
Published Sep 27, 2023
Contribute to Docs
The .getActualMinimum()
method returns the minimum value allowed for a given calendar field.
Syntax
min = cal.getActualMinimum(field);
Where myCalendar
is a Calendar
object, and field
is the constant for which the minimum will be returned.
Example
The below example uses .getActualMinimum()
to retrieve the minimum value for a year and the minimum value for a month.
import java.util.Calendar;public class CalendarDemo {public static void main(String[] args) {// Create a calendarCalendar cal = Calendar.getInstance();// Return the minimum value that the year field could haveint a = cal.getActualMinimum(Calendar.YEAR);System.out.println("Minimum year: " + a);// Return the minimum value that the month field could haveint i = cal.getActualMinimum(Calendar.MONTH);System.out.println("Minimum month: " + i);}}
The output from the snippet above would look like this:
Minimum year: 1Minimum month: 0
All contributors
- Anonymous contributor
Contribute to Docs
- Learn more about how to get involved.
- Edit this page on GitHub to fix an error or make an improvement.
- Submit feedback to let us know how we can improve Docs.
Learn Java on Codecademy
- Career path
Computer Science
Looking for an introduction to the theory behind programming? Master Python while learning data structures, algorithms, and more!Includes 6 CoursesWith Professional CertificationBeginner Friendly75 hours - Free course
Learn Java
Learn to code in Java — a robust programming language used to create software, web and mobile apps, and more.Beginner Friendly17 hours