Java.util.Calendar.getActualMinimum() Method



Description

The java.util.Calendar.getActualMinimum() method returns the minimum value that the specified calendar field could have, based on the time value of this Calendar.

Declaration

Following is the declaration for java.util.Calendar.getActualMinimum() method

public int getActualMinimum(int field)

Parameters

field − the given calendar field.

Return Value

Returns the minimum of the given calendar field.

Exception

NA

Example

The following example shows the usage of java.util.calendar.getActualMinimum() method.

package com.tutorialspoint;

import java.util.*;

public class CalendarDemo {
   public static void main(String[] args) {

      // create a calendar
      Calendar cal = Calendar.getInstance();

      // return the minimum value that the year field could have
      int i = cal.getActualMinimum(Calendar.YEAR);
      System.out.println("Minimum Year :"+ i);

      // returns the minimum value that the month field could have
      int a = cal.getActualMinimum(Calendar.MONTH);
      System.out.println("Minimum month :"+ a);
   }
}

Let us compile and run the above program, this will produce the following result −

Minimum Year :1
Minimum month :0
java_util_calendar.htm
Advertisements