Java .getMinimum()
Published Sep 17, 2023
The .getMinimum() method of the Calendar class returns the minimum value for the given calendar field.
Syntax
calendar.getMinimum(field)
Where the field parameter is the calendar field, for example Calendar.HOUR_OF_DAY.
Example
In the following example, .getMinimum() returns the minimum value for the Calendar.DAY_OF_WEEK field.
import java.util.Calendar;public class Main {public static void main(String[] args) {Calendar calendar = Calendar.getInstance();System.out.println(calendar.getMinimum(Calendar.DAY_OF_WEEK));}}
Output for the above code will be:
1
Learn Java on Codecademy
- Looking for an introduction to the theory behind programming? Master Python while learning data structures, algorithms, and more!
- Includes 6 Courses
- With Professional Certification
- Beginner Friendly.75 hours
- Learn to code in Java — a robust programming language used to create software, web and mobile apps, and more.
- Beginner Friendly.17 hours