.getMinimum()

ChiragAgg5k's avatar
Published Sep 17, 2023
Contribute to Docs

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

All contributors

Contribute to Docs

Learn Java on Codecademy