GregorianCalendar class getMinimum(int field) method example
Returns the minimum value for the given calendar field
GregorianCalendarclass getMinimum(int field)method example. This example shows you how to use getMinimum(int field) method.This method Returns the minimum value for the given calendar field of this GregorianCalendar instance.
Here is the code:-
/**
* @Program that Returns the minimum value for the given calendar field
* GetMinimum.java
* Author:-RoseIndia Team
* Date:-27-May-2008
*/
import java.util.*;
public class GetMinimum {
public static void main(String[] args) {
//Creating a Calendar
GregorianCalendar g = new GregorianCalendar(2004, 6, 3);
//Displays the date of the Calendar
System.out.println("Current date of the Calendar is: " + g.get(Calendar.DATE));
//Returns the minimum value for the given calendar field
int i = g.getMinimum(Calendar.DATE);
System.out.println("Minimum value for the given calendar field is:" + i);
}
} |
Output of the program:-
Current date of the Calendar is: 3
Minimum value for the given calendar field is:1 |
|