The Java Calendar getGreatestMinimum(int field) method returns the highest minimum value for the given calendar field of this Calendar instance.
DeclarationFollowing is the declaration for java.util.Calendar.getGreatestMinimum() method
public abstract int getGreatestMinimum(int field)Parameters
field − the given calendar field.
Return ValueReturns lowest maximum value of the given calendar field.
ExceptionNA
Getting Greated Minimum Year from a Current Dated GregorianCalendar Instance ExampleThe following example shows the usage of Java Calendar getGreatestMinimum() method. We're creating an instance of a GregorianCalendar of current date. Then we're getting greatest minimum value of Year and printing it.
package com.tutorialspoint; import java.util.Calendar; import java.util.GregorianCalendar; public class CalendarDemo { public static void main(String[] args) { // create a calendar Calendar cal = new GregorianCalendar(); // print the greatest min. for year field int result = cal.getGreatestMinimum(Calendar.YEAR); System.out.println("The minimum is: " + result); } }Output
Let us compile and run the above program, this will produce the following result −
The minimum is: 1Getting Greated Minimum Month from a Current Dated GregorianCalendar Instance Example
The following example shows the usage of Java Calendar getGreatestMinimum() method. We're creating an instance of a GregorianCalendar of current date. Then we're getting greatest minimum value of Month using getGreatestMinimum() method and printing it.
package com.tutorialspoint; import java.util.Calendar; import java.util.GregorianCalendar; public class CalendarDemo { public static void main(String[] args) { // create a calendar Calendar cal = new GregorianCalendar(); // print the greatest min. for month field int result = cal.getGreatestMinimum(Calendar.MONTH); System.out.println("The minimum is: " + result); } }Output
Let us compile and run the above program, this will produce the following result −
The minimum is: 0Getting Greated Minimum Day from a Current Dated GregorianCalendar Instance Example
The following example shows the usage of Java Calendar getGreatestMinimum() method. We're creating an instance of a GregorianCalendar of current date. Then we're getting greatest minimum value of Day using getGreatestMinimum() method and printing it.
package com.tutorialspoint; import java.util.Calendar; import java.util.GregorianCalendar; public class CalendarDemo { public static void main(String[] args) { // create a calendar Calendar cal = new GregorianCalendar(); // print the greatest min. for day field int result = cal.getGreatestMinimum(Calendar.DATE); System.out.println("The minimum is: " + result); } }Output
Let us compile and run the above program, this will produce the following result −
The minimum is: 1
java_util_calendar.htm
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4