java日历类add方法
Calendar类的getGreatestMinimum()方法 (Calendar Class getGreatestMinimum() method)
getGreatestMinimum() method is available in java.util package.
getGreatestMinimum()方法在java.util包中可用。
getGreatestMinimum() method is used to get the greatest minimum value of the given calendar field(fi) of this Calendar.
getGreatestMinimum()方法用于获取此Calendar的给定日历字段(fi)的最大值。
getGreatestMinimum() method is a non-static method, it is accessible with the class object and if we try to access the method with the class name then we will get an error.
getGreatestMinimum()方法是一种非静态方法,可通过类对象访问,如果尝试使用类名称访问该方法,则会收到错误消息。
getGreatestMinimum() method does not throw an exception at the time of getting the greatest minimum value of this Calendar.
获取此Calendar的最大值时, getGreatestMinimum()方法不会引发异常。
Syntax:
句法:
public abstract int getGreatestMinimum(int fi);
Parameter(s):
参数:
int fi – represents the calendar field(fi).
int fi –代表日历字段(fi)。
Return value:
返回值:
The return type of the method is int, it returns the greatest minimum value of the given field(fi).
方法的返回类型为int ,它返回给定字段(fi)的最大最小值。
Example:
例:
// Java Program to demonstrate the example of
// int getGreatestMinimum() method of Calendar
import java.util.*;
public class GetGreatestMinimum {
public static void main(String args[]) {
// Instantiating a Calendar object
Calendar ca = Calendar.getInstance();
// Display current calendar
System.out.println("ca: " + ca.getTime());
// By using getGreatestMinimum(int fi) method is
// to return the greatest minimum month value
int month = ca.getGreatestMinimum(Calendar.MONTH);
//Display minimum value of the month
System.out.println("ca.getGreatestMinimum(Calendar.MONTH): " + month);
}
}
Output
输出量
ca: Sun Jan 26 12:24:15 GMT 2020
ca.getGreatestMinimum(Calendar.MONTH): 0
翻译自: https://www.includehelp.com/java/calendar-getgreatestminimum-method-with-example.aspx
java日历类add方法