The java.util.GregorianCalendar.getGreatestMinimum() method is an in-built function in Java which returns the highest minimum value for a calendar field, passed as parameter to the function, of this GregorianCalendar instance. The highest minimum value for any possible time value is defined as the smallest value returned by the get method with the current values of the getFirstDayOfWeek, getMinimalDaysInFirstWeek, getGregorianChange and getTimeZone methods, all taken into consideration.
public int getGreatestMinimum(int calendarfield)
Parameters: This function accepts one mandatory parameter calendarfield of integer type whose highest minimum value will be returned by the function.
Return Value: This method returns an integer which denotes the highest minimum value for the specified calendar field.
Input : DAY_OF_MONTH Output : 1 Input : WEEK_OF_MONTH Output : 0
Below programs illustrate the working of java.util.GregorianCalendar.getGreatestMaximum() function:
Current Date and Time : Wed Aug 01 07:21:14 UTC 2018 Greatest Minimum for WEEK_OF_MONTH field :0 Greatest Minimum for DAY_OF_MONTH field:1
Current Date and Time : Wed Aug 01 07:21:16 UTC 2018 Greatest Minimum for YEAR field :1 Greatest Minimum for HOUR_OF_DAY field:0
Attention reader! Don’t stop learning now. Get hold of all the important Java Foundation and Collections concepts with the Fundamentals of Java and Java Collections Course at a student-friendly price and become industry ready.