Java.util.GregorianCalendar.getLeast Maximum() Java.util.GregorianCalendar.getLeast Maximum() Java.util.GregorianCalendar.getMaximum() 描述 所述java.util.GregorianCalendar.getLeastMaximum(INT字段)方法返回此GregorianCalendar实例给定日历字段的最低最大值。最小的最大值被定义为getActualMaximum(int)为任何可能的时间值返回的最小值,同时考虑到getFirstDayOfWeek,getMinimalDaysInFirstWeek,getGregorianChange和getTimeZone方法的当前值。 声明 以下是java.util.GregorianCalendar.getLeastMaximum()方法的声明 public int getLeastMaximum(int field) 参数 field - 日历字段 返回值 此方法返回给定日历字段的最小最大值。 异常 NA 实例 以下示例显示了java.util.GregorianCalendar.getLeastMaximum()方法的用法。 package com.tutorialspoint; import java.util.*; public class GregorianCalendarDemo { public static void main(String[] args) { // create a new calendar GregorianCalendar cal = (GregorianCalendar) GregorianCalendar.getInstance(); // print the current date and time System.out.println("" + cal.getTime()); // get least maximum for day_of_month int min = cal.getLeastMaximum(GregorianCalendar.DAY_OF_MONTH); System.out.println("Least Maximum:" + min); // get least maximum for YEAR min = cal.getLeastMaximum(GregorianCalendar.YEAR); System.out.println("Least Maximum:" + min); } } 让我们编译并运行上面的程序,这将产生以下结果 Fri May 18 03:08:38 EEST 2012 Least Maximum:28 Least Maximum:292269054 Java.util.GregorianCalendar.getLeast Maximum() Java.util.GregorianCalendar.getMaximum()