Calendar.getLeastMaximum()
« Date
Calendar.getLeastMaximum(field)Minimum of maximum possible value of the input field .
field : field for which the least maximum possible value is required, Example : DAY_OF_MONTH
Returns the least maximum value .
Sample script with output is here.
package my_proj;
import java.util.Calendar;
public class my_first {
public static void main(String[] args) {
Calendar my_cal = Calendar.getInstance();// created calendar
System.out.println(my_cal.getLeastMaximum(Calendar.DAY_OF_WEEK));//7
System.out.println(my_cal.getLeastMaximum(Calendar.DAY_OF_MONTH));//28
System.out.println(my_cal.getLeastMaximum(Calendar.DAY_OF_YEAR));//355
}
}
Here is the code to get YEAR and MONTH ( with output )
System.out.println( my_cal.getLeastMaximum(Calendar.MONTH));//11
System.out.println( my_cal.getLeastMaximum(Calendar.YEAR));//292269054
« getActualMaximum()
« Date & time tutorials
This article is written by plus2net.com team.
plus2net.com