Example usage for java.util GregorianCalendar getLeastMaximum

List of usage examples for java.util GregorianCalendar getLeastMaximum

Introduction

In this page you can find the example usage for java.util GregorianCalendar getLeastMaximum.

Prototype

@Override
public int getLeastMaximum(int field) 

Source Link

Document

Returns the lowest maximum value for the given calendar field of this GregorianCalendar instance.

Usage

From source file:Main.java

public static void main(String[] args) {

    GregorianCalendar cal = (GregorianCalendar) GregorianCalendar.getInstance();

    // 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);

}